Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

is it possible to make perl die on error automatically?

by bdimych (Monk)
on Aug 02, 2011 at 10:14 UTC ( #918009=perlquestion: print w/replies, xml ) Need Help??

bdimych has asked for the wisdom of the Perl Monks concerning the following question:

hi
in bash there is "set -e" feature
is there something similar in perl?
  • Comment on is it possible to make perl die on error automatically?

Replies are listed 'Best First'.
Re: is it possible to make perl die on error automatically?
by Corion (Patriarch) on Aug 02, 2011 at 10:22 UTC
Re: is it possible to make perl die on error automatically?
by davido (Cardinal) on Aug 02, 2011 at 17:20 UTC

    • autodie for IO operations.
    • RaiseError with DBI.
    • XML::Parser: A die call is thrown if a parse error occurs.
    • XML::LibXML will throw an exception if a parsing error occurs.
    • warnings can be elevated to fatals. See perllexwarn.
    • strict will make some risky behaviors an error that won't allow execution to begin.
    • perlrun: Taint mode will throw an exception if it catches you doing unsafe things with tainted input.
    • You can, of course, pepper your code with or die $! or or die "Message..."

    There are plenty of other possibilities too, if we knew what you're after.


    Dave

Re: is it possible to make perl die on error automatically?
by JavaFan (Canon) on Aug 02, 2011 at 15:59 UTC
    Uhm, the default for Perl is to die on error. So, I'm not sure what you are asking.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2023-09-25 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?