Re: RFC: Exception::Handler

2002-01-14 Thread Dominique Quatravaux
One of the things I don't like about traditional try/catch handling is that it doesn't allow for class level programming. You need to allow any subroutine to try/catch exceptions (die). It's also nice to notify any object in the stack that there is an unhandled exception passing through

Re: RFC: Exception::Handler

2002-01-14 Thread Rob Nagler
I'm afraid I don't get it - isn't it what the finally functionality in Error.pm (CPAN) does ? try { stuffThatMayThrow(); } finally { releaseResources(); }; One reason for exceptions is to separate error handling code from the normal control flow. This makes the normal

Re: RFC: Exception::Handler

2002-01-14 Thread Matt Sergeant
On Mon, 14 Jan 2002, Rob Nagler wrote: I'm afraid I don't get it - isn't it what the finally functionality in Error.pm (CPAN) does ? try { stuffThatMayThrow(); } finally { releaseResources(); }; One reason for exceptions is to separate error handling code from

Re: Exception::Handler

2002-01-12 Thread Tatsuhiko Miyagawa
On Fri, 11 Jan 2002 17:39:33 -0500 Jay Lawrence [EMAIL PROTECTED] wrote: For what it is worth - I would encourage you to check out the Error package as well. Exactly, in fact the module can nicely work with Error.pm. See t/*.t for details ;) -- Tatsuhiko Miyagawa Livin' On The

Re: Exception::Handler

2002-01-12 Thread Tatsuhiko Miyagawa
On Fri, 11 Jan 2002 17:34:30 -0600 (CST) Dave Rolsky [EMAIL PROTECTED] wrote: You would have: try { code; } catch FooException with { code for FooExceptions; } catch BarException with { code for BarExceptions; } otherwise { }; And

Re: Exception::Handler

2002-01-12 Thread Matt Sergeant
On Sat, 12 Jan 2002, Tatsuhiko Miyagawa wrote: On Fri, 11 Jan 2002 17:34:30 -0600 (CST) Dave Rolsky [EMAIL PROTECTED] wrote: You would have: try { code; } catch FooException with { code for FooExceptions; } catch BarException with {

Re: Exception::Handler

2002-01-12 Thread Tatsuhiko Miyagawa
On Sat, 12 Jan 2002 10:25:23 + (GMT) Matt Sergeant [EMAIL PROTECTED] wrote: Matt has an idea for doing this with Filter module, instead of nasty closures. Actually unfortunately I even had code, but it was on my laptop that died. Sad. I may resurrect the project in time for this

Re: RFC: Exception::Handler

2002-01-12 Thread Rob Nagler
Matt Sergeant writes: I don't like this for the same reason I don't like $SIG{__DIE__} - it promotes action at a distance. In a 1000 line .pm file I *want* to have my exception catching mechanism next to my eval{} block. You need this flexibility, but Perl allows you to do more, for good

RFC: Exception::Handler

2002-01-11 Thread Tatsuhiko Miyagawa
Seeing through Dave Rolsky's Exception::Class and Sig::PackageScoped has let me make the following module, called Exception::Handler. In fact I rarely use $SIG{__DIE__} for exception handling, but the concept of the module would be a bit interesting. Especially eval { }; if ($@-isa

Re: Exception::Handler

2002-01-11 Thread Jay Lawrence
]; Matt Sergeant [EMAIL PROTECTED] Sent: Friday, January 11, 2002 8:07 AM Subject: RFC: Exception::Handler Seeing through Dave Rolsky's Exception::Class and Sig::PackageScoped has let me make the following module, called Exception::Handler. In fact I rarely use $SIG{__DIE__} for exception

Re: Exception::Handler

2002-01-11 Thread Dave Rolsky
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

Re: RFC: Exception::Handler

2002-01-11 Thread Matt Sergeant
On Fri, 11 Jan 2002, Tatsuhiko Miyagawa wrote: use Exception::Handler MyException = \my_handler, AnotherException = \another_handler, __DEFAULT__ = \default_handler; eval { MyException-throw }; # my_handler() eval { AnotherException

Problem with exception handler in guide?

2002-01-08 Thread Matthew Pressly
I am trying to get the exception class described in the guide to work, but am having trouble with die returning the class incorrectly. The example in the guide was: die My::Exception-RetCode(code = 204); The module code is at: