se strict; package Foo; sub new { return bless({},'Foo'); } sub DESTROY { my ($self) = @_; print "in destroy\n"; local $SIG{__DIE__} = sub {CORE::die @_ }; die "inside destroy and die"; } package main; # here i want to trap eval { my $x = Foo->new; $x = undef; }; print "after eval, \$@ = $@\n"; # here i want the die to really die my $y = Foo->new; $y = undef; print "if I make it here, destroy trapped the die, sigh\n";
[download]