View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Chip Salzenberg > perl5.004 > carp


Annotate this POD

Source   Latest Release: perl-5.14.4


carp - warn of errors (from perspective of caller)

croak - die of errors (from perspective of caller)

confess - die of errors with stack backtrace


    use Carp;
    croak "We're outta here!";


The Carp routines are useful in your own modules because they act like die() or warn(), but report where the error was in the code they were called from. Thus if you have a routine Foo() that has a carp() in it, then the carp() will report the error as occurring where Foo() was called, not where carp() was called.

syntax highlighting: