Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Well... I didn't get any errors, I'm just curious about depending on $SIG{__DIE__}. Is $SIG{__DIE__} always reliable? Is it broken in some older perls? For instance, I know (or heard) that alarm is broken in win32 perls<5.8 (didn't test it myself). Is there a similar condition for $SIG{__DIE__}? I'm interested in perls >= 5.5.3 and ActivePerl >= 5.6.0.

Replies are listed 'Best First'.
Re: Is $SIG{__DIE__} always reliable?
by Anonymous Monk on May 07, 2005 at 22:39 UTC
    Alarm wasn't supported on win32 before 5.8. Unsupported is not broken.
Re: Is $SIG{__DIE__} always reliable?
by thcsoft (Monk) on May 08, 2005 at 03:26 UTC
    you may find some clues by a lecture of perldoc perlvar.

    language is a virus from outer space.
Re: Is $SIG{__DIE__} always reliable?
by polettix (Vicar) on May 08, 2005 at 15:15 UTC
    As I understand it, this is "broken" in connection to eval() use; see perldoc -f eval.

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
    Don't fool yourself.

Re: Is $SIG{__DIE__} always reliable?
by bluto (Curate) on May 09, 2005 at 15:43 UTC
    You probably already know this, but even if it catches a "die" 100% of the time, depending on it for more than a "nice to have, but unnecessary" feature is unwise. It obviously will not catch exit(), uncatchable signals, power failures, nor keep some module you are "use"ing from setting it to something else. I'm not sure I call that "reliable", but YMMV.