Mike_Ca has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl -w use CGI qw(:standard); $| = 1; if (my $pid = fork) { print header,start_html("start"); print ('<META HTTP-EQUIV="Refresh" CONTENT="5; URL=/results/file1. +html">'); print h1('Starting...'); print ('If it does not start up, click <A HREF="/results/file1.htm +l">here</ A>'); print end_html(); } else { close STDIN; close STDOUT; system ('echo \'<META HTTP-EQUIV="Refresh" CONTENT="10; URL=/resul +ts/file.html">\' > /www/html/results/file.html'); exec '/www/cgi-bin/run.pl > /www/html/results/file.html &'; die "couldnt exec - $!\n"; }
Is there a way to print and display the results from run.pl to browser as the results gradually are being generated without having to output the whole result to a temporary file then displaying the file in the end? Thanks
  • Comment on How to output result from perl script to page gradually instead of in 1 shot?
  • Download Code

Replies are listed 'Best First'.
Re: How to output result from perl script to page gradually instead of in 1 shot?
by pboin (Deacon) on Oct 06, 2005 at 17:47 UTC

    I believe this is a client-end thing. Browsers can decide to render contents either before or when the tags all close out. I think that you'll see some differences loading the same content in IE or FireFox for example...

Re: How to output result from perl script to page gradually instead of in 1 shot?
by Perl Mouse (Chaplain) on Oct 06, 2005 at 16:24 UTC
    Considering that exec ought to inherit open file descriptors, replacing the entire code with exec /www/cgi-bin/run.pl should do the trick.
    Perl --((8:>*