NAME
DateTime::TimeZone::Catalog - Provides a list of all valid time zone names
SYNOPSIS
See DateTime::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 Continent/Region
EOF
for my $category ( sort keys %categories ) {
$zonecatalog .= "=head3 $category\n\n";
for my $zone ( @{ $categories{$category} } ) {
$zonecatalog .= " $category/$zone\n";
}
$zonecatalog .= "\n";
}
$zonecatalog .= <<'EOF';
=head2 Zones by Country
EOF
for my $country (
sort { lc $a->[0] cmp lc $b->[0] }
map { [ code2country($_), $_ ] } keys %countries
) {
next if $country->[1] eq 'UK';
$zonecatalog .= "=head3 $country->[0] ($country->[1])\n\n";
for my $zone ( sort { lc $a->[0] cmp $b->[0] }
@{ $countries{ $country->[1] } } ) {
my $line = join ' - ', grep {defined} @{$zone};
$zonecatalog .= " $line\n";
}
$zonecatalog .= "\n";
}
$zonecatalog .= <<'EOF';
=head2 Linked Zones
A linked zone is an alias from one name to another.
EOF
for my $from ( sort keys %links ) {
$zonecatalog .= " $from => $links{$from}\n";
}
$zonecatalog .= "\n";
$zonecatalog .= "=cut\n";
open my $fh, ">lib/DateTime/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, $desc ) = split /\t/, $_;
push @{ $countries{$cc} }, [ $tz, $desc ];
}
return %countries;
}