Subject: | STDERR not autoflushed if used in tee() |
Normally STDERR is not buffered, but if it is used in tee(), then it does not seem to be buffered at all --- which is surprising at least. Consider the following script:
#!/usr/bin/perl
use strict;
use File::Tee;
my $logfile = "/tmp/test.log";
#STDERR->autoflush(1);
#File::Tee::tee(\*STDERR, { autoflush => 1, open => $logfile });
print STDERR "Does it work? (y/n) ";
<STDIN>;
__END__
This is normal behavior --- the prompt appears. If the File::Tee::tee line is activated, then the prompt appears only after hitting RETURN. Workaround is to explictly activate autoflush on STDERR. But again, this is surprising.
(Another thing: maybe the documentation might use the more modern ...->autoflush(1) syntax than using the old approach with setting $| and doing a select before and after)