There are a couple answers (that I know of,) but they are complicated and beyond the scope of explanation on a message board. One way that works is by by forking a process, getting the PID, and checking it periodically from the browser using the PID as a handle. Another is server push, the old animation method before animated gifs. Sorry not to be of more help, but like I say the ones I know of are difficult to explain.
I have a perl CGI script that runs very slow and often takes 10 seconds to print the output. I want to display a message like "Please wait while the program is running" to web users. How can I implement that?
We implemented just this, so as to prevent people sending multiple requests and overloading the server....
Use two scripts.
Script A, stores the parameter string passed in a variable (here I am using $qs), and then uses the REFRESH meta tag to call a second script.
Within <head> and </head> include:
print "<meta http-equiv=\"Refresh\" content=\"1; URL=mysite.com/myscript2.pl?$qs\">\n";
Then within the <body></body> display a please wait message:
print "<h1 align=center>Your search is being processed.</h1>\n";
print "<p><h1 align=center>Please Wait...</h1>\n";
The second (real) script then gets automatically called (by most but not all browsers) via the refresh directive, and when it eventually finishes replaces whats on the screen.
Note: The Refresh meta tag does not work with ALL browsers, but it was the best solution we could find.
Matt