This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test-Simple syncup from Schwern.
[perl5.git] / t / lib / Test / Simple / Catch.pm
CommitLineData
4dd974da 1# For testing Test::Simple;
d020a79a 2package Test::Simple::Catch;
4dd974da 3
d020a79a
JH
4my $out = tie *Test::Simple::TESTOUT, __PACKAGE__;
5my $err = tie *Test::Simple::TESTERR, __PACKAGE__;
4dd974da
JH
6
7# We have to use them to shut up a "used only once" warning.
8() = (*Test::Simple::TESTOUT, *Test::Simple::TESTERR);
9
10sub caught { return $out, $err }
11
12# Prevent Test::Simple from exiting in its END block.
13*Test::Simple::exit = sub {};
14
15sub PRINT {
16 my $self = shift;
17 $$self .= join '', @_;
18}
19
20sub TIEHANDLE {
21 my $class = shift;
22 my $self = '';
23 return bless \$self, $class;
24}
25sub READ {}
26sub READLINE {}
27sub GETC {}
28
291;