Z
Zhiliang Hu
I have a perl script that takes a while to run. I inserted a few
lines in the program to print some progress messages to the console
(STDOUT) so I know where it is at, like:
#!/usr/bin/perl
print STDOUT "Please wait "; #-- This is the very first line in the
script
open(FILE,">localfile");
use DBI;
$dbh = DBI->connect("dbi:mysql:.....");
#-- omitted lines: query and fetch etc.
while (@content = $query_a->fetchrow_array) {
#-- some nested stuff omitted, etc etc
print FILE "--some stuff...\n";
print STDOUT "...";
}
print STDOUT "done\n";
$dbh->disconnect;
close(FILE);
But it prints out nothing to the screen until the very end, when it
finishes, it dumps all for STDOUT at once to the screen. The other
parts of the program runs fine. I thought I have used similar schemes
some years ago and it worked nicely but I cannot see what's wrong
here. Something new on perl 5.8.x or what else could be the cause?
Thanks in advance!
Zhiliang
lines in the program to print some progress messages to the console
(STDOUT) so I know where it is at, like:
#!/usr/bin/perl
print STDOUT "Please wait "; #-- This is the very first line in the
script
open(FILE,">localfile");
use DBI;
$dbh = DBI->connect("dbi:mysql:.....");
#-- omitted lines: query and fetch etc.
while (@content = $query_a->fetchrow_array) {
#-- some nested stuff omitted, etc etc
print FILE "--some stuff...\n";
print STDOUT "...";
}
print STDOUT "done\n";
$dbh->disconnect;
close(FILE);
But it prints out nothing to the screen until the very end, when it
finishes, it dumps all for STDOUT at once to the screen. The other
parts of the program runs fine. I thought I have used similar schemes
some years ago and it worked nicely but I cannot see what's wrong
here. Something new on perl 5.8.x or what else could be the cause?
Thanks in advance!
Zhiliang