On Jun 8, 2004, at 11:34 AM, Scott Stearns wrote: [..]
For you professional Perl programmers: how do you approach
exception-handling in the your world? I know there are a lot of ways Perl
gives us to do this: basic 'die', eval'ing blocks of code and the
Exception.pm module but is there a standard in the real world for handling
exceptions?
[..]
On Jun 8, 2004, at 11:39 AM, Wiggins d Anconia wrote: [..]
In my world, and a scary place it tis', I use a home grown object and just throw it as a return value. Subs generally then return either undef or the exception, or in the case I need a return value back I just check that return value to see if it is an instance of my exception object type.
[..]
As a strategy this seems to be catching on. I have not looked at Schwartz's kvetchings about the Exception::Class - but it too would seem to be working in this tactic; a la:
my $got_back = $obj->method(@args);
if ( ref($got_back) eq "Foo::Bar") { # deal with 'foo::bar' case } else { # else cope with alternative... }
But a core part of the problem is that one either goes back into the 'original code' and starts to clean it up to lace the 'exception handling' into it.
Or one essentially uses it and wraps it with this type of exception handling.
On Jun 8, 2004, at 12:51 PM, Randal L. Schwartz wrote:
In a few weeks, you'll be able to read <http://www.stonehenge.com/merlyn/PerlJournal/col12.html>, or you can get it from TPJ now if you're a subscriber. But in there, I tout Exception::Class as a good solution.
We look forward to the kvetch.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>