I've found a bug (and fix) for the Strptime module.

If you do this:
use DateTime::Format::Strptime;
my $dt=new DateTime::Format::Strptime (pattern => '%O');

print $dt->parse_datetime('America/Chicago');
---> works correctly

print $dt->parse_datetime('America/New_York');
---> prints:
    The timezone 'America/New_york' could not be loaded, or is an
    invalid name.

The bug lies with a regular expression which is missing a /g at the end.

Patch:

--- Strptime.pm 2005-11-29 15:52:51.000000000 +0100
+++ Strptime.pm 2005-11-29 15:47:06.000000000 +0100
@@ -330,7 +330,7 @@

        if ($tz_olson) {
                $tz_olson = ucfirst lc $tz_olson;
-               $tz_olson =~ s|([/_])(\w)|$1\U$2|;
+               $tz_olson =~ s|([/_])(\w)|$1\U$2|g;
                my $tz = DateTime::TimeZone->new( name => $tz_olson );
                $self->local_croak("I don't recognise the time zone 
'$tz_olson'.") and return undef unless $tz;
                $use_timezone = $set_time_zone = $tz;


________________________________________________________________________

Clinton Gormley [EMAIL PROTECTED]

www.TravelJury.com - For travellers, By travellers



Reply via email to