After reading your question multiple times, I realize that you were (IMHO) asking the wrong question.

What you really need is an approach to restrict your logging to uncaught fatal errors only. (the cost of serialization does not matter than!)

I would maybe try to patch the module in question, such that eval { BLOCK } is replaced by something disabling the die-handler.

(and if you are lucky this module already uses something like Try::Tiny and you can restrict your patch there :)

prove of concept:

$SIG{__DIE__}= sub {warn "\$SIG{__DIE__} handles: $_[0]"; }; sub my_eval (&) { eval { local $SIG{__DIE__}; #deactivate die-handler $_[0]->(); } } warn "--- normal eval\n"; eval { die "EVAL\n" } or warn "Eval caught: $@\n"; warn "--- improved eval\n"; my_eval { die "MY_EVAL\n" } or warn "My_Eval caught: $@\n"; warn "--- top level die\n"; die "OUTER SCOPE\n";

OUTPUT:

--- normal eval $SIG{__DIE__} handles: EVAL Eval caught: EVAL --- improved eval My_Eval caught: MY_EVAL --- top level die $SIG{__DIE__} handles: OUTER SCOPE OUTER SCOPE Compilation exited abnormally with code 255 at Thu Jun 12 03:33:59

It's hard to believe that you are the first having this problem, curious to here about other solutions now that the question is clearer.

Cheers Rolf

(addicted to the Perl Programming Language)


In reply to Re: lightweight stack info # wrong question? by LanX
in thread lightweight stack info by hv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.