Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found