xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Simple/t/lib/TieOut.pm (revision b39c515898423c8d899e35282f4b395f7cad3298)
1*b39c5158Smillertpackage TieOut;
2*b39c5158Smillert
3*b39c5158Smillertuse strict;
4*b39c5158Smillert
5*b39c5158Smillertsub TIEHANDLE {
6*b39c5158Smillert    my $scalar = '';
7*b39c5158Smillert    bless( \$scalar, $_[0] );
8*b39c5158Smillert}
9*b39c5158Smillert
10*b39c5158Smillertsub PRINT {
11*b39c5158Smillert    my $self = shift;
12*b39c5158Smillert    $$self .= join( '', @_ );
13*b39c5158Smillert}
14*b39c5158Smillert
15*b39c5158Smillertsub PRINTF {
16*b39c5158Smillert    my $self = shift;
17*b39c5158Smillert    my $fmt  = shift;
18*b39c5158Smillert    $$self .= sprintf $fmt, @_;
19*b39c5158Smillert}
20*b39c5158Smillert
21*b39c5158Smillertsub FILENO { }
22*b39c5158Smillert
23*b39c5158Smillertsub read {
24*b39c5158Smillert    my $self = shift;
25*b39c5158Smillert    my $data = $$self;
26*b39c5158Smillert    $$self = '';
27*b39c5158Smillert    return $data;
28*b39c5158Smillert}
29*b39c5158Smillert
30*b39c5158Smillert1;
31