The proram is embarrassingly small but I cannot stop the print buffer.
What do you mean by "stop the print buffer"?
#!/usr/bin/perl
use strict;
use warnings;
# use FileHandle; STDOUT->autoflush(1);
our $old_fh=select(STDOUT); $|=1; select($old_fh); # Make standard output
socket hot
print "Content-type: text/html\n\n";
print "hallo\n";
print "hallo<br>\n";
sleep(5);
print "hallo<br>\n";
sleep(5);
print "hallo<br>";
sleep(10);
print "hallo<br>";
sleep(2);
The program can be made even smaller and still demonstrate the
condition (I hesitate to call it a "problem" as I do not know what the
problem is.)
#!/usr/local/bin/perl
use strict;
use warnings;
our $old_fh=select(STDOUT); $|=1; select($old_fh); #line 4
for my $n ( 1..5 ) {
print "Line $n "; # line 6
sleep(2);
}
print "\n";
Note that if you replace line 6 with:
print "Line $n\n";
on my system (Mac OS 10.5.7, Perl 5.10.0), the newline character forces
a flush regardless of the autoflush setting on STDOUT. You need to run
the program as shown above with and without line 4 to see the
difference.
Your program looks like a CGI program. Are you trying to run it from a
command-line or from a browser? That will certainly affect your
expected results.
Please explain in more detail the problem you are trying to solve.
Thanks.