Subject: | Misleading diagnostic during constructor eval |
Date: | Wed, 3 Sep 2014 15:02:06 -0000 |
To: | bug-DateTime-TimeZone [...] rt.cpan.org |
From: | "Gordon Marler (BLOOMBERG/ 120 PARK)" <gmarler [...] bloomberg.net> |
I noticed this when I missed one of the dependencies (List::AllUtils) that was added in v1.71, at which point all attempts to create a DateTime::TimeZone object failed with this message:
'Cannot determine local time zone'
Turns out this message is seriously misleading.
Tracing through the debugger, I came across this eval, which in v1.74 is located at line 74 of lib/DateTime/TimeZone.pm:
my $e = do {
local $@;
local $SIG{__DIE__};
eval "require $real_class";
$@;
};
If the class being require'ed isn't available, you should get the actual message returned, like so:
Can't locate List::AllUtils in @INC ...
But you don't. Fixing this would probably eliminate a lot of confusing bug reports against this module.