Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Style Point: Catching eval { } errors

by Beechbone (Pilgrim)
on Nov 27, 2003 at 03:21 UTC ( #310459=note: print w/ replies, xml ) Need Help??


in reply to Style Point: Catching eval { } errors

I defined for our current project that exception handlers must be written as:

eval { # Do stuff }; if (my $e = $@) { # Handle any errors }
This brings the commonly used "e" into the game. I think this makes it more obvious what's happening here.

Ok, in this project it gets even easier:

eval { # Do stuff }; if (my $e = $@) { unless (UNIVERSAL::isa($e, 'Our::Project::Exception')) { $e = Our::Project::Exception::ThirdPartyError->new($e); } # Handle any errors }

Search, Ask, Know


Comment on Re: Style Point: Catching eval { } errors
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (261 votes), past polls