tunafish has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Custom SIG DIE handler that isn't executed in evals
by RonW (Parson) on Sep 14, 2016 at 01:32 UTC | |
by Anonymous Monk on Sep 14, 2016 at 02:02 UTC | |
by tunafish (Beadle) on Sep 14, 2016 at 04:14 UTC | |
by Anonymous Monk on Sep 14, 2016 at 04:35 UTC | |
by RonW (Parson) on Sep 14, 2016 at 18:51 UTC | |
|
Re: Custom SIG DIE handler that isn't executed in evals
by rminner (Chaplain) on Sep 14, 2016 at 10:03 UTC | |
|
Re: Custom SIG DIE handler that isn't executed in evals
by Beechbone (Friar) on Sep 14, 2016 at 10:40 UTC |