in reply to Catch all die in Perl?

You can install a custom handler in %SIG which will catch all fatal errors:

BEGIN { $SIG{__DIE__} = sub { mail( $_[0] ) }; }

That will send the die message to your mail routine. Alternatively, if you don't want to catch all dies, check out the block form of eval.

Replies are listed 'Best First'.
Re^2: Catch all die in Perl?
by Anonymous Monk on Jul 18, 2005 at 21:02 UTC
    Thanks a ton, that code chunk is just what I was looking for!