On Wed, 10 Jul 2002, Matt Sergeant wrote:

> Ah, in that case I'm recommending Dave's stuff. It's more flexible and
> doesn't use that irritating -param stuff. Though I have to do a little
> more research to be certain some things are possible (like turning on
> stack traces globally).

Actually, traces are now _always_ created.  And by default they're shown
when stringifying the exception object.

To turn this off you do:

 Exception::Class::Base->Trace(0);

To turn it off for one branch of the hierarchy, do:

 My::Exception::Subclass->Trace(0);

to turn it back on for a branch below that, do:

 My::Exception::Subclass::SubSubClass->Trace(1);

I'm also planning to add some more features to it.

One is something we're using with Mason, where we create convenience subs
for throwing exceptions so we can do:

 param_error "Missing 'foo' in call to new";

instead of:

 HTML::Mason::Exception::Params->throw( error => "Missing 'foo' in call to new" );

plus as an added bonus the first version gets compile time checking of the
sub name, versus runtime checking of the class name in the second.



-dave

/*==================
www.urth.org
we await the New Sun
==================*/

Reply via email to