Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: exit or die in error handling?

by monkey_boy (Priest)
on Apr 14, 2005 at 10:16 UTC ( [id://447687]=note: print w/replies, xml ) Need Help??


in reply to exit or die in error handling?

I dont think "Memory management" has anything to do with it.
They both end the program, however exit() without an argument returns 0 (which is true in the *nix world).

also, errors should be printed to STDERR not SDTOUT.
So.. third option..
else { die("The parameters for this program are as follows: [job/member/fil +e] [jobnumber/membernumber/filename]"); }



This is not a Signature...

Replies are listed 'Best First'.
Re^2: exit or die in error handling?
by Thilosophy (Curate) on Apr 15, 2005 at 01:10 UTC
    They both end the program,

    I think the most important difference is that die can be caught by an eval (it is Perl's way of doing exceptions) in other parts of the program, so it does not necessarily end the program. Using die thus makes code more easily reusable, and is a good habit to get into.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found