From: Ice Man on
I have created a CGI program which dynamically creates an HTML FORM.
This form upon submit, goes out and does some work that can take up
to
10 minutes to complete. Once done, the called CGI provides the user
with logged results.
My goal is to provide the user with an automated GIF and a message to
please stand by while the program is out doing its work.

I have tried to first display this "Please wait ... processing your
transaction" message at the beginning of the called CGI called
program, before any work is done. I have also tried to call an
intermediary CGI program which displays the message and calls the
working CGI in the background.

In all cases, the message is not displayed until after the CGI
working
program [which takes 10 minutes to complete] has actually completed!

I do not have a large javascript background and I would prefer to
stay
in Perl native. Is there anything I can do here or is my only option
to learn javascripting?

Thanks,
-Bill

From: J. Gleixner on
Ice Man wrote:
> I have created a CGI program which dynamically creates an HTML FORM.
> This form upon submit, goes out and does some work that can take up
> to
> 10 minutes to complete. Once done, the called CGI provides the user
> with logged results.
> My goal is to provide the user with an automated GIF and a message to
> please stand by while the program is out doing its work.

[...]

http://www.stonehenge.com/merlyn/WebTechniques/col20.html
From: Michael Austin on
Ice Man wrote:

> I have created a CGI program which dynamically creates an HTML FORM.
> This form upon submit, goes out and does some work that can take up
> to
> 10 minutes to complete. Once done, the called CGI provides the user
> with logged results.
> My goal is to provide the user with an automated GIF and a message to
> please stand by while the program is out doing its work.
>
> I have tried to first display this "Please wait ... processing your
> transaction" message at the beginning of the called CGI called
> program, before any work is done. I have also tried to call an
> intermediary CGI program which displays the message and calls the
> working CGI in the background.
>
> In all cases, the message is not displayed until after the CGI
> working
> program [which takes 10 minutes to complete] has actually completed!
>
> I do not have a large javascript background and I would prefer to
> stay
> in Perl native. Is there anything I can do here or is my only option
> to learn javascripting?
>
> Thanks,
> -Bill
>

10 minutes? you might store the result set in a file and send it (or a link to
it) via email to the user. you also run the risk of timing-out your web-server
as well as the browser...


--
Michael Austin
Database Consultant
Domain Registration and Linux/Windows Web Hosting Reseller
http://www.spacelots.com
From: Marco Neumann on
Hi, Bill!

> Is there anything I can do here or is my only option
> to learn javascripting?

Javascripting won't help you. Try forking like this in your CGI script:

my $pid;
if (!defined ($pid = fork)) {
# This is executed when the forking did not work
# Output an error message.
}
elsif (! $pid) {

# this is the branch for the child process

close(STDIN);
close(STDOUT);
close(STDERR);

# Do long running stuff here

# Then replace the temporary result file
}

# this is the branch for the parent process
# Output a temporary result file (index.html)
# with "please wait blabla" here.

# Then

print "Location: $temporary_response_file\n\n";

exit;

I hope it works for you.

Marco.


From: Marco Neumann on
> I hope it works for you.

Ups just noticed: Insert this into the head of your temporary output file:

<head>
<meta HTTP-EQUIV="refresh" CONTENT="30">
<meta http-equiv="Pragma" content="no-cache">
</head>

This will make it reload every 30 seconds until the child process outputs
the final result file.

Cheers,
Marco.