in reply to die hooks, signal handlers and eval, all mixed up
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;
|
|---|