Shane Landrum > Net-ICal-0.15 > Net::ICal::Period

Download:
Net-ICal-0.15.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  1
View/Report Bugs
Source  

NAME ^

Net::ICal::Period -- represent a period of time

SYNOPSIS ^

  use Net::ICal;
  $p = new Net::ICal::Period("19970101T120000","19970101T123000");
  $p = new Net::ICal::Period("19970101T120000","PT3W2D40S");
  $p = new Net::ICal::Period(time(),3600);
  $p =   new Net::ICal::Period(
                      new Net::ICal::Time("19970101T120000",
                                          "America/Los_Angeles"),
                      new Net::ICal::Duration("2h"));

DESCRIPTION ^

Use this to make an object representing a block of time on a real schedule. You can either say, "This event starts at 12 and ends at 2" or "This event starts at 12 and lasts 2 hours."

These two ways of specifying events can be treated differently in schedules. If you say, "The meeting is from 12 to 2, but I have to leave at 2," you are implying that the start date and end date are fixed. If you say, "I have a 2-hour drive to Chicago, and I need to leave at 4," you are saying that it will take 2 hours no matter when you leave, and that moving the start time will slide the end time correspondingly.

BASIC METHODS ^

new($time, $time|$duration)

Creates a new period object given to parameters: The first must be a Time object or valid argument to Net::ICal::Time::new.

The second can be either:

Either give a start time and an end time, or a start time and a duration.

new($time, $time|$duration)

Creates a new period object given to parameters: The first must be a Time object or valid argument to Net::ICal::Time::new.

The second can be either:

Either give a start time and an end time, or a start time and a duration.

Create a copy of this component

is_valid()

Return true if: There is an end time and: Both start and end times have no timezone ( Floating time) or Both start and end time have (possibly different) timezones or Both start and end times are in UTC and The end time is after the start time.

  There is a duration and the duration is positive  

Accessor for the start time of the event as a Time object. Can also take a valid time string or an integer (number of seconds since the epoch) as a parameter. If a second parameter is given, it'll set this Duration's start time.

Accessor for the end time. Takes a Time object, a valid time string, or an integer and returns a time object. This routine is coupled to the duration accessor. See duration below for more imformation.

Accessor for the duration of the event. Takes a duration object and returns a Duration object.

Since the end time and the duration both specify the end time, the object will store one and access to the other will be computed. So,

if you create:

   $p = new Net::ICal::Period("19970101T120000","19970101T123000")

And then execute:

   $p->duration(45*60);

The period object will adjust the end time to be 45 minutes after the start time. It will not replace the end time with a duration. This is required so that a CUA can take an incoming component from a server, modify it, and send it back out in the same basic form.

syntax highlighting: