Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Strack traces with Exception::Class

by IlyaM (Parson)
on Nov 04, 2003 at 10:24 UTC ( #304369=note: print w/ replies, xml ) Need Help??

in reply to Strack traces with Exception::Class

From Exception::Class documentation:

* Trace($boolean) Each "Exception::Class::Base" subclass can be set individually to include a a stracktrace when the "as_string" method is called. The default is to not include a stacktrace. Calling this method with a value changes this behavior. It always returns the current value (after any change is applied). This value is inherited by any subclasses. However, if this value is set for a subclass, it will there- after be independent of the value in "Excep- tion::Class::Base". This is a class method, not an object method.

I.e if you need stacktraces for exception class MyException (and its childs) you need to add


Alternatively you can just redefine as_string() method to print uncaught exceptions as you wish.

Ilya Martynov,
Quality Perl Programming and Unix Support UK managed @ offshore prices -
Personal website -

Comment on Re: Strack traces with Exception::Class
Select or Download Code
Replies are listed 'Best First'.
Re^2: Strack traces with Exception::Class
by jffry (Hermit) on Dec 06, 2005 at 19:28 UTC

    Hopefully, this isn't too old to post to.

    I just had to solve this problem myself. I wanted all exceptions to show stack traces all the time. Since Trace($boolean) is a class method, I just did this (see below) once, and it worked for all child/sub classes and their objects.


    I put that right after my use statement.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-10-09 20:59 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (251 votes), past polls