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

Re: deprecating SIGDIE

Thread Previous | Thread Next
From:
Hugo
Date:
September 29, 1999 09:23
Subject:
Re: deprecating SIGDIE
Message ID:
199909291552.QAA10409@crypt.compulink.co.uk
In <199909291345.HAA25822@jhereg.perl.com>, Tom Christiansen writes:
:    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.

I think it is worth mentioning here that this will not catch
'print STDERR ...'.

:    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.

I see it as a handler that is invoked when something calls die(). If the
behaviour changes, I hope we will get a new signal that has the old
behaviour; I would much rather, though, see the new behaviour go to the
new signal rather than breaking existing code. $SIG{__FATAL__} perhaps?
Or even $SIG{__EXIT__}.

Also relevant to both WARN and DIE handlers is the failure to chain.
It would be nice to see a mechanism to allow a call to warn() within
a WARN handler invoke the previous WARN handler rather than falling
straight back to the core handler, and the same for die() in DIE.
This is particularly relevant to packages that use a handler to
implement local behaviour, and thereby bypass a global handler.

Hugo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About