Cirollo has asked for the wisdom of the Perl Monks concerning the following question:
The SQL query that gets printed to the TEE filehandle is pretty huge - it generally takes 35-40 seconds for that block to execute, according to a benchmark. And, it doesn't seem to matter whether the filehandle is buffered. So, can anyone explain why this is happening?# Create the TEE filehandle, which will print to both STDOUT and to a +file open (TEE, "| tee $name") or die "Teeing off: $!\n"; select(TEE); # Now print goes to the TEE handle by default $| = 1; # unbuffer TEE my $stmt = $dbh->prepare("$sql") or die $DBI::errstr; # $sql takes 30- +40 secs. to run $stmt->execute() or die $DBI::errstr; while (my @array = $stmt->fetchrow()) { print; } $stmt->finish(); select(STDOUT); &printfooter(); # prints a here-doc, about 10 lines close(STDOUT) or die "Error closing: $!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Order of output when switching filehandles
by Shendal (Hermit) on Aug 14, 2000 at 22:44 UTC | |
by Cirollo (Friar) on Aug 14, 2000 at 22:52 UTC | |
|
(crazyinsomniac) Re: Order of output when switching filehandles
by crazyinsomniac (Prior) on Aug 14, 2000 at 22:45 UTC | |
by Cirollo (Friar) on Aug 14, 2000 at 22:54 UTC | |
by isotope (Deacon) on Aug 14, 2000 at 23:04 UTC | |
by Cirollo (Friar) on Aug 14, 2000 at 23:12 UTC | |
|
Re: Order of output when switching filehandles
by lhoward (Vicar) on Aug 14, 2000 at 23:27 UTC | |
by Cirollo (Friar) on Aug 14, 2000 at 23:45 UTC |