Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 (Pope) on Aug 02, 2011 at 10:22 UTC
Re: is it possible to make perl die on error automatically?
by davido (Archbishop) 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
Node Status?
node history
Node Type: perlquestion [id://918009]
Approved by moritz
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2018-01-21 15:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (228 votes). Check out past polls.

    Notices?