1# For testing Test::Simple; 2package Test::Simple::Catch; 3 4use Symbol; 5my($out_fh, $err_fh) = (gensym, gensym); 6my $out = tie *$out_fh, __PACKAGE__; 7my $err = tie *$err_fh, __PACKAGE__; 8 9use Test::Builder; 10my $t = Test::Builder->new; 11$t->output($out_fh); 12$t->failure_output($err_fh); 13$t->todo_output($err_fh); 14 15sub caught { return($out, $err) } 16 17sub PRINT { 18 my $self = shift; 19 $$self .= join '', @_; 20} 21 22sub TIEHANDLE { 23 my $class = shift; 24 my $self = ''; 25 return bless \$self, $class; 26} 27sub READ {} 28sub READLINE {} 29sub GETC {} 30sub FILENO {} 31 321; 33