Unfortunately you can't prevent the program terminating like this - as described in perlvar:
The routine indicated by $SIG{__DIE__} is called when a fatal exception is about to be thrown. The error message is passed as the first argument. When a __DIE__ hook routine returns, the exception processing continues as it would have in the absence of the hook, unless the hook routine itself exits via a "goto", a loop exit, or a die(). The "__DIE__" handler is explicitly disabled during the call, so that you can die from a "__DIE__" handler. Similarly for "__WARN__".If you want to catch this *and* not actually die then you need to use eval as well:
local $SIG{__DIE__} = \&foo; + + eval { die "Aiieeee!"; }; + sub foo { print "COpped die"; }
/J\
In reply to Re: Catching DIE no matter what
by gellyfish
in thread Catching DIE no matter what
by kosun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |