Subject: | Carp::Always::Color conflicts with Date::Calc |
Using Carp::Always::Color causes Date::Calc to fail with this exception:
$ perl -e 'use Carp::Always::Color; use Date::Calc'
Can't locate Date/Calc/XS.pm in @INC (@INC contains: ...) at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 26.
eval {...} called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 25
Date::Calc::BEGIN() called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
eval {...} called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
require Date/Calc.pm called at -e line 1
main::BEGIN() called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
eval {...} called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 32.
Date::Calc::BEGIN() called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
eval {...} called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
require Date/Calc.pm called at -e line 1
main::BEGIN() called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
eval {...} called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
BEGIN failed--compilation aborted at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43.
require Date/Calc.pm called at -e line 1
main::BEGIN() called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
eval {...} called at /opt/pkgs/perl-5.16.3/lib/site_perl/5.16.3/Date/Calc.pm line 43
Compilation failed in require at -e line 1.
main::BEGIN() called at -e line 1
eval {...} called at -e line 1
BEGIN failed--compilation aborted at -e line 1.
Here's the relevant piece of code from Date::Calc:
BEGIN # Re-export imports from Date::Calc::XS or Date::Calc::PP:
{
require Exporter;
@ISA = qw(Exporter);
$XS_OK = 0;
unless ($XS_DISABLE and $XS_DISABLE) # prevent warning "used only once"
{
eval
{
require Date::Calc::XS;
@EXPORT = (@Date::Calc::XS::EXPORT);
@EXPORT_OK = (@Date::Calc::XS::EXPORT_OK);
%EXPORT_TAGS = (all => [@EXPORT_OK]);
Date::Calc::XS->import(@EXPORT,@EXPORT_OK);
};
if ($@) { die $@ unless ($@ =~ /^Can't locate .*? at /); }
else { $XS_OK = 1; }
}
unless ($XS_OK)
{
require Date::Calc::PP;
@EXPORT = (@Date::Calc::PP::EXPORT);
@EXPORT_OK = (@Date::Calc::PP::EXPORT_OK);
%EXPORT_TAGS = (all => [@EXPORT_OK]);
Date::Calc::PP->import(@EXPORT,@EXPORT_OK);
}
}
My guess is that the color code bytes are causing the regex to fail to match. Maybe there's a way to avoid adding the colour codes when the exception is in an eval block?