but I can't figure out how to redirect the carp output
Carp provides a routine shortmess, which just returns the string that carp would write to STDERR. So you could say
my $error; opendir(DIR, $dir) or $error = Carp::shortmess("Could not open $dir"); mail($error) and die $error if $error;
I have no idea, though, why shortmess is no longer documented in 5.10.x (in 5.8.8 it was), despite the fact that it's still there and works...
Actually, the implementation of carp is just sub carp { warn shortmess @_ }. And shortmess is also in @EXPORT_OK.
P.S.: Does anyone know if it has been deprecated (nothing related is mentioned in either the 5.10 or the 5.8 docs), or what else might be wrong with using it?
In reply to Re: Improving the Error Handling of my Scripts
by almut
in thread Improving the Error Handling of my Scripts
by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |