diff options
Diffstat (limited to 'mysql-test/lib/My/Tee.pm')
-rw-r--r-- | mysql-test/lib/My/Tee.pm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/lib/My/Tee.pm b/mysql-test/lib/My/Tee.pm new file mode 100644 index 00000000..8d6b4ddd --- /dev/null +++ b/mysql-test/lib/My/Tee.pm @@ -0,0 +1,25 @@ +package My::Tee; +use IO::Handle; + +# see PerlIO::via + +our $copyfh; + +sub PUSHED +{ + open($copyfh, '>', "$::opt_vardir/log/stdout.log") + or die "open(>$::opt_vardir/log/stdout.log): $!" + unless $copyfh; + bless { }, shift; +} + +sub WRITE +{ + my ($obj, $buf, $fh) = @_; + print $fh $buf; + $fh->flush; + print $copyfh $buf; + return length($buf); +} + +1; |