Net::ICal::Standard - class for representing STANDARD timezone sections


Net-ICal documentation Contained in the Net-ICal distribution.

Index


Code Index:

NAME

Top

Net::ICal::Standard -- class for representing STANDARD timezone sections

DESCRIPTION

Top

This module represents a STANDARD section in a VTIMEZONE, which details information about when a particular timezone is on "standard" (not daylight-savings) time.

SYNOPSIS

Top

    # really, look at Timezone.pm for a better usage example;
    # this is totally untested

    my $s = Net::ICal::Standard->new(
        tzoffsetto => '-0500',
        tzoffsetfrom => '-0400',
        rdate => Net::ICal::Recurrence->new ( ...)
        tzname => 'EST'
    );
=cut




METHODS

Top

new(%args)

Makes a new Standard object. Permissible arguments are:

* tzoffsetto - the UTC offset this timezone's in now
* tzoffsetfrom - the UTC offset this timezone was in before it changed
* rdate - a recurrence date to describe when this timezone will switch times again
* rrule - a recurrence rule to describe when this timezone shifts clocks again
* tzname - a human-readable name for this timezone.

See RFC2445 4.6.5 for more details on how this all works.


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: Standard.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::Standard;
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
        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,
   	    },
        tzoffsetto => {	# RFC2445 4.8.3.4 - optional in VTIMEZONE
	        type => 'parameter',
	        doc => 'UTC offset in use now in this timezone',
	        domain => 'param',
	        options => [],
	        value => undef,
   	    },
        tzoffsetfrom => {	# RFC2445 4.8.3.3 - optional in VTIMEZONE
	        type => 'parameter',
	        doc => 'UTC offset in use prior to the current offset in this tz',
	        domain => 'param',
	        options => [],
	        value => undef,
   	    },
   	    rdate => {	# RFC2445 ? - optional multiple times in VTIMEZONE
	        # TODO: this should point to another N::I data type
            type => 'parameter',
	        doc => 'recurrence date',
	        domain => 'ref',
	        options => 'ARRAY',
	        value => undef,
   	    },
   	    rrule => {	# RFC2445 ? - optional multiple times in VTIMEZONE
	        # TODO: this should point to another N::I data type
	        type => 'parameter',
	        doc => 'a recurrence rule',
	        domain => 'ref',
	        options => 'ARRAY',
	        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 ('STANDARD', $map, %args);

    return $self;
}

1;