On Thu, 1 Nov 2001, Stephen Adkins wrote:

> On the use of Exceptions in P5EE, Perrin Harkins mentioned
> in his article about the e-Toys mod_perl installation that he
> used Graham Barr's "Error" class (which I could find nowhere
> on CPAN).

http://search.cpan.org/search?dist=Error

> Is there a consensus on what exception class/framework we should
> be using in P5EE?

Its possible to use both.  Error.pm provides an exception object as well
as try/catch functions.

Exception::Class is mostly about providing exception objects.  The nice
thing about Exception::Class (IMNSHO ;) is that it allows you to declare a
hierarchy of exceptions.  Error.pm does not give you any way to do this so
you'd have to manually do it, like:

 package P5EE::Exception::Foo;

 our @ISA = 'Error::Simple';

 package P5EE::Exception::Foo::Bar;

 our @ISA = 'P5EE::Exception::Foo';

With Exception::Class this'd look like:

 use Exception::Class ( 'P5EE::Exception::Foo',
                        'P5EE::Exception::Foo::Bar' => { isa => 'P5EE::Exception::Foo' 
);

Also the exception object API for each module is a little different.

However, its possible to do this:

 @Exception::Class::Base::ISA = 'Error::Simple';

which then lets you combine the two.


-dave

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

Reply via email to