1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
use strict;
use warnings;
use Test::More;
use TryCatch;
{
package ROBOT;
sub DESTROY {
# Something that does it 'wrong' and stomps on $@
eval {};
}
}
sub test {
my ($create_object) = @_;
try {
try {
my $obj;
$obj = bless {}, "ROBOT" if ($create_object);
eval {
die "IN EVAL";
};
local $SIG{__DIE__} = sub { print "old die handler\n"};
die "ERROR";
}
catch ($e) {
print "caught error '$e'\n";
return;
}
}
catch ($e) {
return $e;
}
print "caught nothing\n";
}
test();
test(1);
local $TODO = "work out what this needs to test";
fail;
done_testing;
|