NAME

Net::ICal::Component -- the base class for ICalender components

SYNOPSIS

You never create an instance of this class directly, so we'll assume $c is an already created component.

# returns an ICal string for this component.
$c->as_ical;

DESCRIPTION

This is the base class we derive specific ICal components from. It contains a map of properties which can be set and accessed at will; see the docs for Class::MethodMapper for more on how it works.

CONSTRUCTORS

new($name, $map, %args)

Creates a new ICal component of type $name, with Class::MethodMapper map $map and arguments %args. You never call this directly, but you use the specific component's new constructor instead, which in turn calls this.

new_from_ical($icaldata)

Creates a new Net::ICal::Component from a string containing iCalendar data. Use this to read in a new object before you do things with it.

Returns a Net::ICal::Component object on success, or undef on failure.

METHODS

type ([$string])

Get or set the type of this component. You aren't supposed to ever
set this directly. To create a component of a specific type, use
the new method of the corresponding class.

validate

Returns 1 if the component is valid according to RFC 2445. If it isn't undef is returned, and $@ contains a listref of errors

as_ical

Returns an ICal string that represents this component

has_one_of (@propertynames)

returns a true value if one of the listed property names is present on the component and undef if not

has_required_property (name, [value])

checks whether the component has a value for property 'name' and optionally checks whether it is value 'value'

has_illegal_property (name)

checks whether the component has a value for property 'name' and returns a true value if it has, and undef if it doesn't

has_only_one_of (name1, name2)

returns undef if both the properties name1 and name2 are present. Otherwise, it returns a true value. On error, it sets $@.

INTERNAL METHODS

These are for internal use only, and are included here for the benefit of Net::ICal developers.

_identify_component($line)

the first line of the iCal will look like BEGIN:VALARM or something. we need to know what comes after the V, because that's what sort of component we'll be creating.

Returns ALARM, EVENT, TODO, JOURNAL, FREEBUSY, etc, or undef for failure.

_create_component($comp)

$comp is "ALARM" or something. We generate the name of a type of object we want to create, and call the _create method on that object.

_unfold(@lines)

Handle multiline fields; see "unfolding" in RFC 2445. Make all the multiple fields we've been handed into single-line fields.

_fold($line)

_parse_lines(\@lines)

Parse and validate the lines of iCalendar data we got to make sure it looks iCal-like.

_parse_property($property)

Given a property line from an iCalendar file, parses it and returns the name and the value of that property.

_parse_parameter($propname)

Given a property name/key section, parses it and returns the param name and the parameter string.

_load_property($class, $value, $line)

If a new ICal subclass object needs to be created, load the module and return a new instance of it. Otherwise, just return the value of the property.

SEE ALSO

Net::ICal

More documentation pointers can be found in L<Net::ICal>.

Class::MethodMapper

Most of the internals of this code are built on C::MM. You need to
understand what it does first.