VTIMEZONES.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 26 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
timezones
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::ICal::VTIMEZONES;
2  
3 use vars qw($timezones);
4  
5 BEGIN {
6 use Net::ICal::Config;
7 my $zonedir = $Net::ICal::Config->{'zoneinfo_location'} || "zoneinfo";
8  
9 # I have no idea what the first two fields in this file mean, but
10 # the third one is all Olsen timezone names.
11 my $zonefile = "$zonedir/zones.tab";
12  
13 open(ZONEFILE, $zonefile)
14 or die ("Couldn't open timezone info file $zonefile");
15  
16 while (<ZONEFILE>) {
17 my @fields = split(' ', $_);
18 my $zonename = $fields[2];
19 $timezones->{$zonename} = {};
20 $timezones->{$zonename}->{'file'} = "$zonedir/$zonename.ics";
21 }
22 }
23  
24 =head1 NAME
25  
26 Date::ICal - Perl extension for ICalendar date objects.
27  
28 =head1 SYNOPSIS
29  
30 my $zones = Net::ICal::VTIMEZONES::timezones;
31  
32 # a list of all the zones
33 @zonenames = keys %{$timezones};
34  
35 # to get a file to load VTIMEZONE data from
36 $zonefile = $zones->{'America/Bogota'}->{'file'};
37
38 =head1 METHODS
39  
40 =head2 timezones
41  
42 Returns a hashref of hashrefs; the hashref's keys are names of
43 timezones. Each timezone hash has one element at present, "file",
44 which is the file where you can get VTIMEZONE information
45 for this timezone.
46  
47 =cut
48  
49 sub timezones {
50 return $timezones;
51 }
52  
53 1;
54 __END__