The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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 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 .= "=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, undef ) = split /\t/, $_;

        push @{ $countries{$cc} }, $tz;
    }

    return %countries;
}