Welcome to the Monastery | |
PerlMonks |
perlfunc:dieby gods (Initiate) |
on Aug 24, 1999 at 22:42 UTC ( [id://235]=perlfunc: print w/replies, xml ) | Need Help?? |
dieSee the current Perl documentation for die. Here is our local, out-dated (pre-5.6) version: die - raise an exception or bail out
die LIST
Outside an eval(), prints the value of
LIST to Equivalent examples:
die "Can't cd to spool: $!\n" unless chdir '/usr/spool/news'; chdir '/usr/spool/news' or die "Can't cd to spool: $!\n"
If the value of
EXPR does not end in a newline, the current script
line number and input line number (if any) are also printed, and a newline
is supplied. Hint: sometimes appending
die "/etc/games is no good"; die "/etc/games is no good, stopped"; produce, respectively
/etc/games is no good at canasta line 123. /etc/games is no good, stopped at canasta line 123.
If
LIST is empty and
eval { ... }; die unless $@ =~ /Expected exception/;
If
You can arrange for a callback to be run just before the die() does its deed, by setting the
Note that the
die @_ if $^S; as the first line of the handler (see 1). |
|