| Carp Dokumentation zu Perl 5.8.0 | Download als POD | Wie kann ich hier etwas ändern? |
cluck - warn of errors with stack backtrace
(not exported by default)
croak - die of errors (from perspective of caller)
confess - die of errors with stack backtrace
shortmess - return the message that carp and croak produce
longmess - return the message that cluck and confess produce
use Carp;
croak "We're outta here!";
use Carp qw(cluck);
cluck "This is how we got here!";
print FH Carp::shortmess("This will have caller's details added");
print FH Carp::longmess("This will have stack backtrace added");
Any call from a package to itself is safe.
Packages claim that there won't be errors on calls to or from packages explicitly marked as safe by inclusion in @CARP_NOT, or (if that array is empty) @ISA. The ability to override what @ISA says is new in 5.8.
The trust in item 2 is transitive. If A trusts B, and B trusts C, then A trusts C. So if you do not override @ISA with @CARP_NOT, then this trust relationship is identical to, "inherits from".
Any call from an internal Perl module is safe. (Nothing keeps user modules from marking themselves as internal to Perl, but this practice is discouraged.)
Any call to Carp is safe. (This rule is what keeps it from reporting the error where you call carp/croak/shortmess.)
perl -MCarp=verbose script.pl
or by including the string MCarp=verbose in the PERL5OPT environment variable.