Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: lightweight stack info

by cursion (Pilgrim)
on Jun 11, 2014 at 21:00 UTC ( #1089600=note: print w/replies, xml ) Need Help??

in reply to lightweight stack info

Check Perldoc Carp for info on shutting it off for parts of code (or only turning it on in your code).

Maybe using caller() just when you do catch an exception could work too.

Replies are listed 'Best First'.
Re^2: lightweight stack info
by hv (Parson) on Jun 11, 2014 at 22:33 UTC

    Thanks; it'd certainly be possible to locally disable the annotation (a $SIG{__DIE__} handler, it isn't Carp internals we're talking about at this point) when we know we're going to call certain things; but that's not really the intended use - the idea is that for *any* exception that ends up not getting caught we want to know the call stack where it was raised: this is a mechanism for helping us become aware of and diagnose bugs we don't know about yet, and disabling it in some places means either asserting those sections of code are guaranteed bug-free, or just accepting that bugs in those sections of code will be harder to diagnose (and we may miss them altogether).

    As for doing the annotation at the point of catching: I don't think that helps us, we know what the call stack will look like at that point, it's what the call stack looked like at the point the exception was raised that's interesting.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2020-11-29 17:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found