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: 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

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 {