summaryrefslogtreecommitdiffstats
path: root/mysql-test/lib/My/Tee.pm
blob: 8d6b4ddd52fef381897b24ee16cdc762dfc4019e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;