Ibrahim Dawud wrote:
> Hello,
>
> The following code works great using normal perl but does not work
> under mod_perl:
>
> #!/usr/bin/perl
>
> use CGI;
> my $cgi = new CGI;
> print $cgi->header();
> print $cgi->start_html();
> $| = 1;
> print $cgi->h2("test1");
> sleep 1;
> $| = 1;
> print $cgi->h2("test2");
> sleep 1;
> $| = 1;
> print $cgi->h2("test3");
> print $cgi->end_html();
>
> The purpose of the code is print periodic messages to the browser
> during long processing. Can someone please explain or show an example
> of how I can flush the output buffer when running the same code under
> mod_perl. According to my understanding, I have to do this at the
> level of the Apache API using rflush. The problem is that I don't know
> how to write such a handler and even if i did, i don't know how to
> call it into my existing CGI code in place of $|=1.
>
> Suggestions are highly appreciated.
>
> Thanks
>
$| sets autoflush for the selected filehandle, default is STDOUT. You
need only set it once, before any output.
See:
perldoc -q flush
perldoc perlvar (and search for "$|")
perldoc IO::handle
--
__END__
Just my 0.00000002 million dollars worth,
--- Shawn
"For the things we have to learn before we can do them, we learn by
doing them."
Aristotle
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>