Subject: | Carp::Heavy unsplit can cause really odd errors |
Date: | Fri, 14 Sep 2012 17:02:43 +0100 |
To: | bugs-Carp [...] rt.cpan.org |
From: | Matt S Trout <mst [...] shadowcat.co.uk> |
If a user has an updated Carp in a local::lib or similar, and manages
to load an old Carp.pm -before- those are applied, they get the vestigial
Carp::Heavy and as such some subs aren't defined (short_error_loc being
the one my client just got nailed by).
i.e.
use FindBin qw($Bin);
use lib "/home/me/perl5/lib/perl", "$Bin/../lib";
is a failure waiting to happen, because FindBin loads Carp.pm but not
Carp/Heavy.pm
My suggestion would be, in Carp/Heavy.pm, to do a $VERSION check after
loading Carp and if it's not the one this Heavy.pm was shipped with to
complain loudly, something like
die "Carp::Heavy from Carp 1.26 loaded but Carp.pm $Carp::VERSION was loaded,"
." did you modify \@INC after loading Carp somehow?"
unless $Carp::VERSION == 1.26;
although I'm entirely open to alternatives.
--
Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue
http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/
Email me now on mst (at) shadowcat.co.uk and let's chat about how our Catalyst
commercial support, training and consultancy packages could help your team.