in reply to [SOLVED] YAML, $SIG{__DIE__}, Log4perl, $^S, and eval{}

There's no need to die within $SIG{__DIE__}. Log at whatever level you wish (error, fatal, whatever), and let perl die properly. It's already going to anyway.

How to fix your other problems that using $SIG{__DIE__} causes is another story entirely. I can't really see a way around it, as its working as intended. When you start noodling with that kind of stuff, where you selectively say "Oh, I didn't meant to actually die" I see this as a road to insanity. You're going to have to insert all of the logging statements anyway, unless your existing logging already kind of conforms to how Log::Log4perl does.

That said, the $^S may be a "temporary" (haha) solution until you can get the code base to conform to something a bit more sane, along with not using logdie in $SIG{__DIE__}.

Replies are listed 'Best First'.
Re^2: YAML, $SIG{__DIE__}, Log4perl, $^S, and eval{}
by ateague (Monk) on Mar 21, 2014 at 14:34 UTC
    I can't really see a way around it, as its working as intended. When you start noodling with that kind of stuff, where you selectively say "Oh, I didn't meant to actually die" I see this as a road to insanity.

    No argument here! I realized I may have been going down the wrong path when I had to start using conditional tests against the Perl interpreter state...

    That being said, the whole purpose of the $SIG{__DIE__} wrapper was to (try to) seamlessly add Log4perl output to an existing script without having to hunt down and change all the die() calls in the code.