On Feb 10, 2004, at 11:53 AM, Dan Muey wrote:

perl -MCarp -e '$SIG{__WARN__} = sub { $err = shift; };
carp "Error!\n"; print "We caught $err";'


This works great!


And changing $SIG{__WARN__} to '' will return default behaviour correct?
(Same thign with __DIE__ ??)

Just undef them:


undef $SIG{__WARN__};

Strangely though, this did not work for me, though I expected it to:

perl -MCarp -e '$SIG{__DIE__} = sub { $err = shift; }; croak
"Error!\n"; print "We caught $err";'


Anyone have any idea how to get $SIG{__DIE__} to act like the $SIG{__WARN__} ?
I'm sure it has something to do with die doing an exit() or soemthing.

This was my misunderstanding. I looked back over the __DIE__ handler. It gets called on the way down, it doesn't override the fact that you are going down. My bad. Use __WARN__.


James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to