Click here to get back home

web page automatic update

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
web page automatic update packat 08-15-2004
Posted by packat on August 15, 2004, 2:32 am
Please log in for more thread options
I wanted to generate a web page using CGI scripts. The script would
query a database and display result. I wanted to make the page
automatically update at a regular pace, say every 1 minute.

Is there a perl function that would do this?

Thnaks
pac



Posted by Sherm Pendley on August 14, 2004, 10:44 pm
Please log in for more thread options
packat wrote:
> I wanted to generate a web page using CGI scripts. The script would
> query a database and display result. I wanted to make the page
> automatically update at a regular pace, say every 1 minute.
>
> Is there a perl function that would do this?

Sure, just cache the generated results somewhere. When the CGI is hit,
check the cache - if the file with the results page is either missing or
more than a minute old, regenerate it before sending it.

For checking the presence and/or age of a file, the file test operators
are your friends. See 'perldoc -f -X'.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Posted by Jürgen Exner on August 15, 2004, 3:19 am
Please log in for more thread options
packat wrote:
> I wanted to generate a web page using CGI scripts. The script would
> query a database and display result. I wanted to make the page
> automatically update at a regular pace, say every 1 minute.
>
> Is there a perl function that would do this?

Starting jobs at a regular interval (or at a given time) is typically done
using the job scheduler of you operating system ("cron" on Unix, "at" or
"Task Scheduler" on Windows, etc.). However, I am not certain that all
common job schedulers support a resolution of 1 minute.

If accuracy of the timing is not a major concern of yours, then you could
use Perl's sleep() function to send the process to sleep for a minute (there
may be systematic inaccuracies, which will add up over time. If you want to
catch those you would have to keep track of the time in your program
yourself).
But if you go that route you will still need to provide initial startup and
a watchdog mechanism, which would restart the program when it terminates or
get hung for whatever reason. The job scheduler would do that part for you
for free.

jue




Posted by gnari on August 15, 2004, 12:12 pm
Please log in for more thread options
> I wanted to generate a web page using CGI scripts. The script would
> query a database and display result. I wanted to make the page
> automatically update at a regular pace, say every 1 minute.
>
> Is there a perl function that would do this?

If you want the page generation to happen every minute,
see other answers.

if you just want the browser to
automatically refresh, then this is not a perl matter,
but a HTML or javascript.
in that case you should ask the relevant newsgroups for
better info, but sometimes this is done with a <META> tag

gnari






Posted by Arnold Huebsch on August 16, 2004, 2:14 pm
Please log in for more thread options
packat wrote:
> I wanted to generate a web page using CGI scripts. The script would
> query a database and display result. I wanted to make the page
> automatically update at a regular pace, say every 1 minute.
>
> Is there a perl function that would do this?


using CGI.pm you might do the following:

print $query->header(-REFRESH=>"60");

to generate a selref reshing WEB page.

--
Arnold Huebsch




Similar ThreadsPosted
Sending "page up" and "page down" character problem. September 7, 2004, 1:59 pm
automatic updates May 24, 2006, 8:30 am
Tk::MusicSheet... update August 3, 2006, 7:09 am
update framework July 20, 2007, 9:20 am
lwp authentication on asp page March 23, 2005, 10:28 pm
Module to get text from a PDF page? January 6, 2005, 8:52 pm
Delayed WEB Page Response February 6, 2008, 7:11 pm
ANNOUCE: Data::Page::Viewport V 1.01 February 14, 2005, 10:43 am
ANNOUCE: Data::Page::Viewport V 1.02 February 21, 2005, 10:04 am
LWP::UserAgent and redirected page responses October 21, 2005, 12:33 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap