Personally, I suggest you don't use $SIG{__DIE__} and instead use eval. I find the whole design of $SIG{__DIE__} to be flawed. It can be useful in limited circumstances but it can't scale well and I find it best to just avoid it.
But, if you do use $SIG{__DIE__}, then you need to know about $^S: "True if inside an eval(), otherwise false." so you can do:
for example.$SIG{__DIE__}= sub { die @_ if $^S; # rest of code here };
Update: How do you replace $SIG{__DIE__} with eval, you ask?
becomes$SIG{__DIE__}= sub { die @_ if @^S; doStuffWith( $_[0] ); }; doEverythingElse(); exit 0;
or thereabouts. - tye (but my friends call me "Tye")eval { doEverythingElse(); 1; } or do { doStuffWith( $@ ); }; exit 0;
In reply to (tye)Re: die hooks, signal handlers and eval, all mixed up
by tye
in thread die hooks, signal handlers and eval, all mixed up
by Amoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |