# For testing Test::Simple;
-package Catch;
+# $Id$
+package Test::Simple::Catch;
-my $out = tie *Test::Simple::TESTOUT, 'Catch';
-my $err = tie *Test::Simple::TESTERR, 'Catch';
+use Symbol;
+use TieOut;
+my( $out_fh, $err_fh ) = ( gensym, gensym );
+my $out = tie *$out_fh, 'TieOut';
+my $err = tie *$err_fh, 'TieOut';
-# We have to use them to shut up a "used only once" warning.
-() = (*Test::Simple::TESTOUT, *Test::Simple::TESTERR);
+use Test::Builder;
+my $t = Test::Builder->new;
+$t->output($out_fh);
+$t->failure_output($err_fh);
+$t->todo_output($err_fh);
-sub caught { return $out, $err }
-
-# Prevent Test::Simple from exiting in its END block.
-*Test::Simple::exit = sub {};
-
-sub PRINT {
- my $self = shift;
- $$self .= join '', @_;
-}
-
-sub TIEHANDLE {
- my $class = shift;
- my $self = '';
- return bless \$self, $class;
-}
-sub READ {}
-sub READLINE {}
-sub GETC {}
+sub caught { return( $out, $err ) }
1;