| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Data::ICal::TimeZone::Object - base class for Data::ICal::TimeZone timezone objects | ||
| 4 | |||
| 5 | =head1 METHODS | ||
| 6 | |||
| 7 | =over | ||
| 8 | |||
| 9 | =item timezone | ||
| 10 | |||
| 11 | Returns the timezone identifier for the current zone object | ||
| 12 | |||
| 13 | =item definition | ||
| 14 | |||
| 15 | Returns a Data::ICal::Entry::TimeZone which defines the given zone. | ||
| 16 | |||
| 17 | =back | ||
| 18 | |||
| 19 | =HEAD1 SEE ALSO | ||
| 20 | |||
| 21 | L<Data::ICal::TimeZone> | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | package Data::ICal::TimeZone::Object; | ||
| 26 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | 2 | ▶ | use base qw( Class::Singleton Class::Accessor ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 2 | __PACKAGE__->mk_accessors(qw( _cal )); | |
| 29 | 2 | ▶ | use Data::ICal; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | 800 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | 800 | my $self = shift; | |
| 33 | 800 | return $self->instance; | |
| 34 | } | ||
| 35 | |||
| 36 | 401 | ▶ | sub definition { |
|
Subroutine
definition: called CC=1 SCAR=0.0
Pod
documented
| |||
| 37 | 401 | my $self = shift; | |
| 38 | my @zones = grep { | ||
| 39 | 401 | $_->ical_entry_type eq 'VTIMEZONE' | |
| 40 | 401 | } @{ $self->_cal->entries }; | |
| 41 | 401 | return $zones[0]; | |
| 42 | } | ||
| 43 | |||
| 44 | 400 | ▶ | sub timezone { |
|
Subroutine
timezone: called CC=1 SCAR=0.0
Pod
documented
| |||
| 45 | 400 | my $self = shift; | |
| 46 | 400 | return $self->definition->property('tzid')->[0]->value; | |
| 47 | } | ||
| 48 | |||
| 49 | 400 | ▶ | sub _load { |
|
Subroutine
_load: called CC=1 SCAR=0.0
| |||
| 50 | 400 | my $self = shift; | |
| 51 | 400 | my $ics = shift; | |
| 52 | 400 | my $cal = Data::ICal->new( data => $ics ); | |
| 53 | 400 | $self->_cal( $cal ); | |
| 54 | 400 | return; | |
| 55 | } | ||
| 56 | |||
| 57 | 2 | 1; | |