++ed by:

117 PAUSE user(s)
93 non-PAUSE user(s).

Malcolm Beattie


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!";

    use Carp qw(cluck);
    cluck "This is how we got 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.

Forcing a Stack Trace


This feature is enabled by 'importing' the non-existant symbol 'verbose'. You would typically enable it by saying

    perl -MCarp=verbose script.pl


Hosting generously
sponsored by Bytemark