So I've wrapped up warn and die in order to log whatever they say using Log::Log4perl. However, in my code at one point, I perform an eval, planning to check $@ and ignore it in the most common case, but re-die again if it is something unexpected. Unfortunately, this breaks logging by my definition: I'm still ignoring the case of $@ I specified, but that caught exception is getting logged. I don't want that.
I can mess around with local and removing the %SIG handler, but that still doesn't fix all my problems: I'm calling a module where the author also does an eval that runs some code that occasionally traps an exception I definitely don't want to see (and don't even understand).
I want my @SIG{'__WARN__','__DIE__'} to not fire within an eval. Anyone know how to do that?
Surely there's more than one way to do it... (Score:2)
Second, I think I saw a module recently that did a
before invoking the eval or even inside it, before doing anything dangerous.
Some modules even do
though I don't know about any benefit. I guess there is none.
Re: (Score:2)
That special var looks like what I want! Thank you!. Although by now I've adopted a totally different approach to get around it. :) But I still wanted to know the answer, because this is going to bite me again.
I tried local and the DEFAULT thing, but it still became a problem because I'm using modules by other people that do eval's.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
-Dom
Re: (Score:2)
Personally I would have preferred it if $SIG{__DIE__} handlers would just not be called in eval. Life would have been a lot simpler, then.