Carp::Always comeback

originally published in PerlMonks

Carp::Always is a minimalist debugging aid, often used from the command line with usage patterns like

perl -MCarp::Always



Using Carp::Always decorates the output of each warn() and die() with stacktraces. For example,

$ perl -MCarp::Always -e 'sub f { die "arghh" }; sub g { f }; g;'
arghh at -e line 1
        main::f() called at -e line 1
        main::g() called at -e line 1

This is meant to help finding where issues actually coming from at the code being inspected.

Last week I had the chance to revisit Carp::Always code. It was basically abandoned since the 0.13 release back in 2013. One could say that there was not much work to do about it and that it withstood the test of times as many other CPAN modules that haven't seen updates in a long time. That is not quite true: the bug backlog kept growing and it is quite possible that the few Carp::Always users may have disbanded to newer alternatives like [mod://Devel::Confess].

The main changes in the latest 0.16 release are:

  • Fix for a long standing bug with duplicate tracebacks - see a mention of it in the 2011 Perl Advent

  • Carp::Always now enabled / disabled by import() / unimport() rather than using BEGIN and END blocks

The bug backlog has been cleared (both at GitHub and CPAN RT queue) to make room for brand new bugs. =)

Hopefully, these updates will extend Carp::Always lifetime and usefulness. You're invited to give it a try.

Leave a comment

About Adriano Ferreira

user-pic I blog about Perl.