$spans =~ s/-inf/DateTimeX::Lite::TimeZone::NEG_INFINITY/g; $spans =~ s/inf/DateTimeX::Lite::TimeZone::INFINITY/g;
$spans =~ s/('(?:start|end)_date'\s+=>\s+)'(\d+)'/$1$2/g;
my $string = "[\n"; $string .= join "\n", map { serialize_span($_) } @$spans; $string .= "\n]";
return $string;
print "'$v' -> "; if ($v eq '-inf') { print "(should set to NEG_INF) "; $v = &DateTimeX::Lite::NEG_INFINITY; } elsif ($v eq 'inf') { print "(should set to INF) "; $v = &DateTimeX::Lite::INFINITY; } print "'$v'\n";
my $string = " [\n"; $string .= join ",\n", @$span{@keys}; $string .= ",\n'$span->{short_name}'"; $string .= "\n ],";
return $string;
# This is cleaner than making the above a double-quoted string $generator =~ s/!RULES/Dumper \@rules/eg; $generator =~ s/!LAST_OBSERVANCE/Dumper $last_observance/eg; $generator =~ s/\$VAR1->{'local_start_datetime'}{'tz'}/bless( { 'name' => 'floating', 'offset' => 0 }, 'DateTimeX::Lite::TimeZone::Floating' )/; $generator =~ s/\$VAR1->{'utc_start_datetime'}{'tz'}/bless( { 'name' => 'floating', 'offset' => 0 }, 'DateTimeX::Lite::TimeZone::Floating' )/; $generator =~ s/!OFFSET/$offset/g;
return $generator;
NAME
DateTimeX::Lite::TimeZone::Catalog - Provides a list of all valid time zone names
SYNOPSIS
See DateTimeX::Lite::TimeZone for API details.
DESCRIPTION
This module contains an enumerated list of all known system timezones, so that applications can easily present a list of timezones.
AVAILABLE ZONES
Zones by Region
EOF
for my $category ( sort keys %categories )
{
$zonecatalog .= "=head3 $category\n\n";
for my $zone ( @{ $categories{$category} } )
{
$zonecatalog .= " $category/$zone\n";
}
$zonecatalog .= "\n";
}
open my $fh, ">lib/DateTimeX/Lite/TimeZone/Catalog.pm" or die $!;
print $fh $zonecatalog or die $!;
close $fh or die $!;
}
sub parse_zone_tab { my $file = File::Spec->catfile( $opts{dir}, 'zone.tab' );
open my $fh, "<$file" or die "Cannot read $file: $!";
my %countries;
while (<$fh>)
{
next if /^\#/;
chomp;
my ( $cc, undef, $tz, undef ) = split /\t/, $_;
push @{ $countries{$cc} }, $tz;
}
return %countries;
}