Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thanks for the information!

Anyone using caller indirectly, such as through Carp, would be dealing with already compiled code and it would ignore your override.

Given the choice of the slowness of a global override and having someone in the debugger evaluate a Carp and get results that will probably show up in the debugger (since Carp with one level is the most common case), I'll opt for the faster different eval results. If I come accross a specific case where I am annoyed by this, I'll reassess then

Another potential issue is that CORE::caller() has special cased behavior for when called from the DB package. Your code will cause all caller calls to be from the DB package, which means @DB::args will always be populated even when that wasn't the intent. While that doesn't break any obvious things, it is a change in semantics. The effect of this is also currently limited by the previously mentioned compilation issue.

Properly maintaining the semantics of the original function takes extra care. I would recommend looking at Sub::Uplevel. You can likely use it directly to do the frame skipping, fixing both of the above issues. If not, its code can provide guidance on what you need to do.

I don't immediately see how this changes things in my case.

I looked at Sub::Uplevel. The environment and faking going on in my DB code is sufficiently complex that I don't want to introduce more stuff, and other routines adding additional fakery, unless I understand why specifically it is needed. I rely on the tests I have written and when those are insufficient, bug reports and my own experience to tell me if I think things are okay.

In reply to Re^7: How/can one do save/restore CORE::caller inside an eval? by rockyb
in thread How/can one do save/restore CORE::caller inside an eval? by rockyb

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, 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, 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.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (4)
    As of 2020-11-28 03:11 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found