in reply to How to stream output to html page?

Use something like this - it works for me (running Apache):

#!/usr/bin/perl use CGI; $| = 1; my $q = new CGI; print $q->header(-type => 'text/html'); print "<pre>\n"; print "Running date:\n"; system("date"); print "sleeping...\n"; sleep(10); print "Running ls:\n"; system("ls"); print "</pre>\n";

Most http servers now will stream output from CGI scripts to clients. That wasn't always the case in the early years.

Replies are listed 'Best First'.
Re^2: How to stream output to html page?
by stickman (Acolyte) on Mar 01, 2008 at 19:49 UTC
    OK, I'm stupid..my script worked fine after I put "$| = 1;" in it. What does that do??

      $| is also known as $OUTPUT_AUTOFLUSH (if you use English). According to the documentation, "If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel." See perlvar for more.

        cool..thanks to everybody for your help!