Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Forcing stack trace?

by tinita (Parson)
on Sep 21, 2007 at 11:29 UTC ( #640338=note: print w/replies, xml ) Need Help??


in reply to Forcing stack trace?

Can I tell perl to produce a stack trace, even when the program doesn't use carp, cluck, et al?
i'm not sure what do you mean by that.
use Carp qw(longmess); print longmess();
works for me.

Replies are listed 'Best First'.
Re^2: Forcing stack trace?
by Anonymous Monk on Sep 21, 2007 at 11:56 UTC
    From what I understand, stack trace can be printed if we use the Carp module (e.g. confess). But suppose other people's code just use die() and not use Carp at all?
      You can override the global __DIE__ handler something like (untested):
      use Carp; $SIG{ __DIE__ } = sub { Carp::confess( @_ ) };

      See perlvar for more info on %SIG.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2023-03-21 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (59 votes). Check out past polls.

    Notices?