in reply to Printing that "waiting" page or call it win32::process::create problem

Another way to do this is with "server push", using CGI::Push. Basically, this involves sending a document of type "multipart/x-mixed-replace", consisting of two or more subdocuments, which can be of any mime type. The key is that the connection is kept open between documents, and each subdocument, as it's made ready by the server and received by the browser, replaces its predecessor. In your case, you'd have two documents:
  1. The "Please wait" page.
  2. The requested data.
Older Microsoft browsers (e.g. IE4) cannot handle server push. However, all modern browsers should have no trouble with it. I've tested it with Netscape 4.76 (Win and Linux), Opera 6 (Win and Linux), and Mozilla (Linux) with no problems. Apache users should note that the script name must start with the prefix "nph-" for this to work, as in "nph-myscript.pl". IIS apparently doesn't have this requirement, although I've not tried it with IIS.

A sample script to illustrate the technique follows:

#!/usr/bin/perl -T use strict; use CGI::Push; my $q = CGI::Push->new; $q->do_push( -next_page => \&Do_wait, -last_page => \&Get_data, -delay => 0 ); sub Do_wait { my ($q, $counter) = @_; return undef if $counter > 1; return '<html>Please wait...</html>' } sub Get_data { sleep 3; # Simulate dbi accesss delay... return "<html>Here's your stuff.</html>" }
  • Comment on Re: Printing that "waiting" page or call it win32::process::create problem
  • Download Code