Also, as long as you're using CGI.pm, you should use it to generate your HTML output. Your script should probably look like this:
#!/usr/bin/perl -w use strict; use CGI qw/:standard/; print header(), p('hello world'), ; sleep 2; print p('testing'), end_html(), ; That'll generate XHTML Transitional compliant code, without having keep up with it yourself (too much). On Thursday 01 September 2005 07:56 am, Alexander Charbonnet wrote: > Do you have mod_deflate active in your output chain? mod_deflate slurps up > all its input and only prints when its buffer gets full. > > On Thursday 01 September 2005 07:52 am, pradeep kumar wrote: > > Hi, > > > > I have a perl script which uses $| to set autoflush on. Basically, it > > flushes after every print. This script is working fine from the command > > line when run using standalone perl interpreter. But when the same script > > is accessed via mod_perl/apache setup, mod_perl is not flushing after > > every print, instead buffering and printing all output at one shot. > > Any idea why $| is not working with mod_perl. > > > > Here is my sample script: > > > > #!/usr/bin/perl -w > > > > use CGI qw/:standard/; > > use strict; > > select(STDOUT); > > $| = 1; > > print STDOUT "Content-type: text/html\n\n"; print STDOUT <<END; <html> > > <head> </head> <body> END print STDOUT 'hello'; print STDOUT '<br>'; > > sleep(2); print STDOUT 'World'; print STDOUT '<br>'; sleep(2); print > > STDOUT 'Testing'; print STDOUT "</body></html>"; > > > > > > Thanks in advance, > > Pradeep