perlvar says this:
Due to an implementation glitch, the $SIG{__DIE__} hook is called even inside an eval(). Do not use this to rewrite a pending exception in $@ , or as a bizarre substitute for overriding CORE::GLOBAL::die() . This strange action at a distance may be fixed in a future release so that $SIG{__DIE__} is only called if your program is about to exit, as was the original intent. Any other use is deprecated.
Is there a work-around for this? I would like to have a production script e-mail me whenever it encounters a fatal error. A die inside an eval is not such a circumstance.
It looks like a possible work around could be to check Carp's longmess() and see if the stack contains an eval at any point. But I'm not sure what other consequences this might have. Am I thinking in the right direction?
In reply to Custom SIG DIE handler that isn't executed in evals by tunafish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |