For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > February 2007 > Re: Perl:CGI - Creating a Please wait message









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Perl:CGI - Creating a Please wait message
Ice Man

2007-02-16, 6:59 pm

On Feb 16, 1:32 pm, "nobul...@gmail.com" <nobul...@gmail.com> wrote:
> On Feb 16, 4:30 pm, "Ice Man" <wjharris...@optonline.net> wrote:
>
>
>
> "CGI" and "background" seem to be an oxymoron.
>
> The background process is not a CGI script. A CGI script it one that's
> communicating with the web server process using the CGI API.
>
> One very simplistic but very robust and actually quite efficient
> approach is for the CGI script to create a uniquely named simple HTML
> file on the server containing the "please wait" message and a <META
> HTTP-EQUIV> tag to make it refresh. The CGI then forks-off the
> background process (telling it the name of the file) and returns an
> HTTP redirect to instruct the client fetch this HTML file.
>
> The reason I say this is "quite efficient" is that although client is
> polling the server every, say, 10 seconds all the server is sending
> back each time is a 304 "Not Modified" response.
>
> When the background process has finished writing its HTML file it
> simply renames it over the top of the file containing the please wait
> message.
>
> For a 10 minute process I'd consider making the background process
> periodically create progress report HTMLs and rename them over the
> orginal please -wait message.
>
> You may need to put some web caching hints on the server directory
> where you are putting these files so that intermediate web caches know
> that they should always confirm that their cache is up to date.
>
>
> I suspect this means the background process did not properly disociate
> itself from the httpd process - i.e. it didn't close the STD*
> filehandles.
>
> See FAQ "How do I fork a daemon process?"
>
> Very little of this, of course, as anything to do with Perl.


========================================
===================
Curious as to why you would make the last statement!

The FORM CGI is written in perl. The background process is a perl
program
[sorry for the mis-typing]. To me ... this is all about perl!

I will try your suggestion and report back. I am not sure of your
methods to keep
track of the completion of the background process but I will give it a
whirl and let
you know.

I appreciate your prompt comments. I was expecting something like
this to be
found in a CGI:Perl manual because it provides the user feedback which
is essential
in any program which takes time.

Thanks,
Bill

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com