Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^12: Learning how to use the Error module by example

by adrianh (Chancellor)
on Jul 30, 2003 at 15:49 UTC ( #279219=note: print w/ replies, xml ) Need Help??


in reply to Re: Re^10: Learning how to use the Error module by example
in thread Learning how to use the Error module by example

The only thing that's "wrong" with return is that you have more than 2 return codes.

But why are multiple return statements "worse" than multiple throw statements? Why replace the boolean functionality found everywhere else in Perl with your own exception based mechanism? Why move mainline code into catch blocks?

I think we're just going to have to agree to disagree over this one! If I was a maintenance developer faced with the code you gave, or:

print $self->find($foo) ? "found" : "Not found"; if ( $@ ) { # Handle error here };

I know which I'd prefer :-)


Comment on Re^12: Learning how to use the Error module by example
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://279219]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2014-08-28 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls