Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
When Perl 5.8 comes out you will be able to control this behaviour through use of @CARP_NOT.

In the meantime the only solutions are to either replace the offending functions with your own (in general a bad idea) or be sure that you inherit from all classes that errors might come from.

Some explanation might be in order.

The reason is that Carp's way of finding where to report an error from is to walk the stack, looking for the first "untrusted" call. How is that determined? Well any call from a package to itself is trusted. Any call to or from a subclass is trusted. (OK, in 5.005 and earlier the implementation used a hack that didn't always do that.) Calls to and from Carp are trusted. (OK, that is the new implementation. The old one just arranged to have 2 call levels, and used goto liberally to keep it so. Blech.)

So in effect, there is a trust relationship built transitively out of whatever was in @ISA. Therefore the only way to control what would be reported where is by arranging to inherit from the class you don't want to report errors from. The change in 5.8 is that if you supply @CARP_NOT, Carp uses that for establishing the trust relationship instead of @ISA. (Because inheritance and "new code" are separate concepts.)


In reply to Re (tilly) 1: Confusion about properly using Carp by tilly
in thread Confusion about properly using Carp by jeffa

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 imbibing at the Monastery: (4)
As of 2024-04-19 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found