Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How to handle Errors?

by dragonchild (Archbishop)
on Apr 05, 2004 at 16:43 UTC ( #342682=note: print w/replies, xml ) Need Help??


in reply to How to handle Errors?

The canonical way to handle errors in Perl is to use die and eval. You throw your errors using die and catch them using the block form of eval. You can even throw objects with die and catch them with eval, for fine-grained handling. There are many examples in the various manuals.

Do NOT use Error, because it can cause memory leaks in a number of situations.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2023-02-05 20:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (32 votes). Check out past polls.

    Notices?