Devel::Confess - Include stack traces with all errors/warnings
Edit: Since writing this, I've decided on a proper name. Devel::Confess is the name for this module going forward. Carp::Always::EvenObjects exists now only as a wrapper around Devel::Confess.
Carp::Always is a very useful module that will force all errors and warnings to include a full stack trace to help with debugging. However, it has some limitations. If an exception object is thrown rather than a string, the stack trace can't simply be appended to it. die, Carp, and Carp::Always just pass the object through unmodified. Some exception systems include stack traces in their objects, but for those that don't, this hurts the ability to debug. As more libraries use exception objects, this becomes more problematic (e.g. autodie).
With that in mind, I've written Carp::Always::EvenObjects. It works similarly to Carp::Always, but will also attach stack traces to objects. This is done by re-blessing the object into a subclass that knows how to include the stack trace when the object is stringified. Most exception systems the same as the originals.
It will also attach stack traces to plain non-object refs, although their use as exceptions is rather rare.
Normally you would use the module on the command line, as:
perl -MCarp::Always::EvenObjects script.pl
As a bonus, since the name is rather long, the dist includes the module Devel::Confess as an alias, allowing you to use the shorter:
perl -MDevel::Confess script.pl
perl -d:Confess script.pl
That seems like it should have been made as an enhancement to Carp::Always.
I did propose it to the author of Carp::Always, but he didn't want to add it. He prefers keeping Carp::Always simple and small, a decision I can't fault him for.
My module has more than 6 times as much code, and is less safe than Carp::Always.
. o O ( Does the devil confess? )