On Fri, 11 Jan 2002, Jay Lawrence wrote:

> For what it is worth - I would encourage you to check out the Error package
> as well.
>
> Rather than:
>
>  eval { };
>   if ($@->isa('FooException')) {
>       # ...
>   } elsif ($@->isa('BarException')) {
>       # ...
>   } else {
>       # ...
>   }
>
> You would have:
>     try {
>         code;
>     } catch FooException with {
>         code for FooExceptions;
>     } catch BarException with {
>         code for BarExceptions;
>     } otherwise {
>     };

And the fun potential for memory leaks with nested closures.

> And you can throw exceptions with details on the nature of the exception:
>
>     throw FooException ( -text => "You foo'ed at line bar", -value =>
> $line );

You can do that without using Error.pm's try/catch stuff by simply using
Error's exception objects or the Exception::Class provided exception
objects.

AFAICT, Tatsuhiko's module is designed to work with either of those types
of objects transparently, but it provides an alternate mechanism for
catching exceptions.

And anything inspired by my Sig::PackageScoped module scares me, but its
an interesting idea ;)


-dave

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

Reply via email to