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?? |
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()?
In Section
Seekers of Perl Wisdom
|
|