[boulder.pm] print/exit on error?
Rob Nagler
nagler at bivio.com
Thu Aug 17 10:27:28 CDT 2000
> What is the cleanest way to make a perl script do something along the line
> or print out a variable (the file it's currently reading), $_, and then
> exit when it gets such an error?
There are a couple of ways, but probably the easiest is to:
$SIG{__DIE__} = \&Carp::confess;
I also like:
$SIG{__WARN__} = \&Carp::cluck;
You can always write your own sub and call Carp, e.g.
$SIG{__DIE__} = sub {
print STDERR "This is dollar underscore: ", $_;
Carp::confess(@_);
};
More information about the Boulder-pm
mailing list