in reply to Re^3: logging, to include unhandled exceptions
in thread logging, to include unhandled exceptions
I guess the only remain point of confusion I have is about die itself. perlfunc isn't clear on this, as I read it. When something "blows up" in a script, is die what perl invokes, under the covers? It seems not to be, except when it is (so to speak). Consider this code:
# $SIG{__DIE__} = sub { print "I died.\n"; exit 0 }; BEGIN { *CORE::GLOBAL::die = sub { print "Died in the new die.\n"; exit 0; }; } print "Requiring something bogus.\n"; require "bogus"; print "Done requiring something bogus.\n";
When I leave the $SIG line commented out, I do not see "Died in the new die". When I uncomment the $SIG line, however, I do see "I died". That's counter-intuitive, since you wouldn't think that $SIG{__DIE__} would fire in the absence of an actual call to die.
Anyway, as a result of that, I'm inclined to go with the $SIG approach after all, since it seems to catch this kind of a failure -- which is what I'm trying to accomplish. Thanks again!
|
|---|