Gossamer Forum
Home : General : Perl Programming :

Streaming returned data...

Quote Reply
Streaming returned data...
Hello there,

I've got a script that takes a little time to process, and I'd like to send a "Processing..." message to the user while it's working. Normally I could do this via GET and a META refresh tag, but this is data that's being encrypted, so I'd prefer to do it a different way.

I guess I have to use server push, but I'm at a loss as to how. Is it possible to push another page after the original page is loaded? I've seen something like this done on shopping sites, but I'm not sure how they do it...

As usual, any help will be rewarded with a hearty slap on the back, and a pint when I go on my world tour! Smile

adam
Quote Reply
Re: Streaming returned data... In reply to
Turn your script into a nph- script and then apache won't buffer the output (assuming Unix and Apache here). It's simple:

Code:
#!/usr/bin/perl

use CGI;
CGI->nph(1); # Set nph mode
$|++; # Unbuffer
print CGI->header();

print "Processing...\n\n";
&do_something_complex;
print "All done...\n\n";
# -------------------------------------

and just make sure to call your script nph-something.cgi.

Hope that helps,

Alex