Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Getting croak to show both caller and callee?

by Anonymous Monk
on Apr 25, 2015 at 05:26 UTC ( [id://1124645]=note: print w/replies, xml ) Need Help??


in reply to Getting croak to show both caller and callee?

Hmmm. Sorry, formatting sucked. Here it is again.

Hi, friends.

So we use "croak" all the time. We have some code though that does dynamic dispatching, and the "croak" shortmess (only showing the caller origin) is inadequate. All we see is the error happening in the "dispatch" routine, but we really need to see where it was dispatched *to*.

Of course, just using "die" in this situation works fine; it shows the actual location of the croak. But since we use "croak" so often, we screw it up sometimes and use croak rather than die.

So my question is: is there a way to coax Carp::croak into showing *both* the caller and the callee of the croak call?

Another alternative is to use $Carp::Verbose, so we get a full backtrace -- that does indeed work too. Just that it also generates a huge callstack that we'd rather not see on every exception.

If Carp::croak cannot be convinced to do this, any suggestions? Maybe write our own "croak" routine that uses Carp's shortmess()?

  • Comment on Re: Getting croak to show both caller and callee?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1124645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-26 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found