Subject: | $::TZ is not processed |
Date: | Wed, 1 Jun 2016 15:32:25 +0100 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | Steven Hartland <steven.hartland [...] multiplay.co.uk> |
When setting $::TZ to configure the timezone for Date-Manip it fails.
Enabling debugging shows it thinks its not set:
*** DEBUG *** METHOD: main [TZ] undef
*** DEBUG *** METHOD: env [zone,TZ] undef
*** DEBUG *** METHOD: file [/etc/TIMEZONE] not found
*** DEBUG *** METHOD: file [/etc/timezone] not found
*** DEBUG *** METHOD: file [/etc/sysconfig/clock] not found
*** DEBUG *** METHOD: file [/etc/default/init] not found
*** DEBUG *** METHOD: tzdata [] UTC
Test script:
$ENV{'DATE_MANIP_DEBUG'} = 1;
$::TZ = 'UTC';
require Date::Manip;
The cause is the use of $$::var which actually check the value of var
and not what $var is.
The following patch fixes the problem:
--- TZ.pm.orig 2016-06-01 14:23:17.959723621 +0000
+++ TZ.pm 2016-06-01 14:23:49.886834275 +0000
@@ -424,9 +424,10 @@ sub _get_curr_zone {
}
my $var = shift(@methods);
print "$var] " if ($debug);
- if (defined $$::var) {
- push(@zone,$$::var);
- print "$$::var\n" if ($debug);
+ my $val = eval "\$::$var";
+ if (defined $val) {
+ push(@zone,$val);
+ print "$val\n" if ($debug);
} else {
print "undef\n" if ($debug);
}
Regards
Steve