4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
15 use Test::More 'no_plan';
17 require Test::Builder;
18 my $tb = Test::Builder->new;
21 # Test that _try() has no effect on $@ and $! and is not effected by
24 local $SIG{__DIE__} = sub { fail("DIE handler called: @_") };
28 is $tb->_try(sub { 2 }), 2;
29 is $tb->_try(sub { return '' }), '';
31 is $tb->_try(sub { die; }), undef;
33 is_deeply [$tb->_try(sub { die "Foo\n" })], [undef, "Foo\n"];
40 $tb->_try(sub { die "Died\n" }, die_on_fail => 1);