develooper Front page | perl.perl5.porters | Postings from September 1999

deprecating SIGDIE

Thread Next
Tom Christiansen
September 29, 1999 06:46
deprecating SIGDIE
Message ID:
Doc fodder:

    The %SIG interface supports two pseudo-signals.  These aren't real
    signals, and they aren't subject to the normal core dump warnings.
    A C<$SIG{__WARN__}> handler is called when Perl would like to deliver
    a warning, such as through warn() or carp().  It gets the warning
    string as an argument.  If you warn() from within the handler, you
    get the real one.  A C<$SIG{__DIE__}> handler is called when you
    program is about to exit due to an untrapped exception.  Think of
    it as an C<END{}> that's only called if an exception wasn't caught.

    Due to a bug, a C<$SIG{__DIE__}> handler is also called on I<any>
    exception, I<even one that was trapped>!  This is incorrect behaviour
    that Larry plans to deprecate or even remove in the next release
    of Perl.  To protect oneself from strangenesses, every exception
    handler every written must currently locally disable C<$SIG{__DIE__}>.

	eval {
	    local $SIG{__DIE_)__};

    One must also write such handlers to inspect the abstruse C<$^S>
    variable to detect whether the thing was being trapped anyway:

	$SIG{__DIE__} = sub {
	    return if $^S;

I'd much rather fix this right now than document the bug.  Sarathy?
Larry?  Is it toast yet?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About