| Net-ICal documentation | Contained in the Net-ICal distribution. |
Net::ICal::Timezone -- class for representing VTIMEZONEs
This module represents VTIMEZONEs, which detail important information about timezones. For any timezone, you need to know some important factors related to it, namely:
This object represents those concepts with arrays of Net::ICal::Standard and Net::ICal::Daylight objects. For more detail on why, see RFC2445 4.6.5.
If you want some real data to test this module against, see http://primates.ximian.com/~damon/icalendar/zoneinfo.tgz , which is a set of VTIMEZONE files that aims to describe every timezone in the world. We'll be relying on those files in a future release as a master timezone database. They're a translation of the Olsen timezone database found on Unix systems.
use Net::ICal::Timezone;
# we know this works
my $tz = Net::ICal::Timezone->new_from_ical($ical_text);
# we haven't tested this yet, patches welcome
my $tz = Net::ICal::Timezone->new(
tzid => 'America/New_York',
standards => [
(Net::ICal::Standard objects)
],
daylights => [
(Net::ICal::Daylight objects)
]
);
=cut
Makes a new Timezone object. Permissible arguments are:
| Net-ICal documentation | Contained in the Net-ICal distribution. |
#!/usr/bin/perl -w # vi:sts=4:shiftwidth=4 # -*- Mode: perl -*- #====================================================================== # # This package is free software and is provided "as is" without # express or implied warranty. It may be used, redistributed and/or # modified under the same terms as perl itself. ( Either the Artistic # License or the GPL. ) # # $Id: Timezone.pm,v 1.4 2001/08/04 05:43:32 srl Exp $ # # (C) COPYRIGHT 2000-2001, Reefknot developers. # # See the AUTHORS file included in the distribution for a full list. #======================================================================
package Net::ICal::Timezone; use strict; use base qw(Net::ICal::Component); use Carp; use Net::ICal::Property; use Net::ICal::Util qw(:all);
#============================================================================ sub new { my ($class, %args) = @_; my $self = &_create ($class, %args); return undef unless (defined $self); return undef unless ($self->validate); return $self; } #=================================================================================
# THIS IS INHERITED FROM Net::ICal::Component #================================================================================== # make sure that this object has the bare minimum requirements specified by the RFC
sub validate { my ($self) = @_; # TODO: fill in validation here return $self->SUPER::validate ($self); }
sub _create { my ($class, %args) = @_; my $map = { # RFC2445 4.6.5 describes VTIMEZONE tzid => { # RFC2445 4.8.3.1 - REQUIRED, only once type => 'parameter', doc => 'unique identifier for this timezone', domain => 'param', value => undef, options => [], }, lastmod => { # RFC2445 ? - optional, 1x only in VTIMEZONE type => 'parameter', doc => 'last time this item was modified', domain => 'param', value => undef, options => [], }, tzurl => { # RFC2445 4.8.3.5 - optional, 1x only in VTIMEZONE type => 'parameter', doc => 'a URL for finding the latest version of this VTIMEZONE', domain => 'param', value => undef, options => [], }, standards => { # RFC2445 4.6.5 - required >=1x in VTIMEZONE type => 'parameter', doc => 'a set of standard timezone info', value => undef, domain => 'ref', options => 'ARRAY', }, daylights => { # RFC2445 4.6.5 - required >=1x in VTIMEZONE type => 'parameter', doc => 'a set of daylight timezone info', value => undef, domain => 'ref', options => 'ARRAY', }, dtstart => { # RFC2445 4.6.5? - optional in VTIMEZONE, type => 'parameter', doc => '', domain => 'ref', # TODO, BUG 424114: needs to be in UTC. how to enforce? options => 'Net::ICal::Time', value => undef, }, comment => { # RFC2445 ? - optional multiple times in VTIMEZONE type => 'parameter', doc => 'comment about this timezone', domain => 'param', options => [], value => undef, }, tzname => { # RFC2445 4.8.3.2 - optional multiple times in VTIMEZONE type => 'parameter', doc => 'a name for this timezone', domain => 'param', options => [], value => undef, }, # FIXME: handle x-properties. }; my $self = $class->SUPER::new ('VTIMEZONE', $map, %args); return $self; } 1;