Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: die function

by Zaxo (Archbishop)
on Aug 02, 2006 at 05:54 UTC ( [id://565168]=note: print w/replies, xml ) Need Help??


in reply to die function

The die function prints a message given by its arguments to STDERR and exits gracefully. The difference between having die inside and outside an eval block is that, inside, the exit is trapped at the next statement beyond the eval block, and the die message is placed in $@ instead of printing to STDERR. That allows recovery from error conditions, much like the try..throw..catch construct found in C++ and Java.

To get the file and line number printed, just avoid an explicit newline at the end of the die message.

If, in your shell, you say:

$ perldoc -f die
you'll get all this info and much more, straight from perlfunc.

After Compline,
Zaxo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-24 18:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found