Carp reference
Perl has a Carp module, that prints error messages from the context of the caller. This page gives an overview of the available functions in the module.
- Documentation
- Source: /usr/share/perl/5.14/Carp.pm1
routine | output | stacktrace | exported |
---|---|---|---|
carp | warn | no2 | yes |
croak | die | no2 | yes |
confess | die | yes | yes |
cluck | warn | yes | no |
longmess | return | yes3 | no |
shortmess | return | no | no |
- Or find the source file of Carp using
perl -MCarp -e 'print $INC{"Carp.pm"}."\n"' - Except if Carp can not determine the caller, for example because all packages are in @CARP_NOT or $Carp::Internal, or $Carp::CarpLevel is set too high. Or if $Carp::Verbose is set, or the symbol verbose is imported.
- longmess returns a stacktrace, but the topmost stackframe is missing. The function in which you call longmess won't be in the stacktrace. You can call the undocumented Carp::longmess_heavy directly to get the full stack trace.