1Data::ICal::Entry(3) User Contributed Perl Documentation Data::ICal::Entry(3)
2
3
4
6 Data::ICal::Entry - Represents an entry in an iCalendar file
7
9 my $vtodo = Data::ICal::Entry::Todo->new();
10 $vtodo->add_properties(
11 # ... see Data::ICal::Entry::Todo documentation
12 );
13
14 $calendar->add_entry($vtodo);
15
16 $event->add_entry($alarm);
17
19 A Data::ICal::Entry object represents a single entry in an iCalendar
20 file. (Note that the iCalendar RFC refers to entries as "components".)
21 iCalendar defines several types of entries, such as events and to-do
22 lists; each of these corresponds to a subclass of Data::ICal::Entry
23 (though only to-do lists and events are currently implemented).
24 Data::ICal::Entry should be treated as an abstract base class -- all
25 objects created should be of its subclasses. The entire calendar
26 itself (the Data::ICal object) is also represented as a
27 Data::ICal::Entry object.
28
29 Each entry has an entry type (such as "VCALENDAR" or "VEVENT"), a
30 series of "properties", and possibly some sub-entries. (Only the root
31 Data::ICal object can have sub-entries, except for alarm entries
32 contained in events and to-dos (not yet implemented).)
33
35 new
36 Creates a new entry object with no properties or sub-entries.
37
38 as_string [ crlf => "CRLF" ]
39 Returns the entry as an appropriately formatted string (with trailing
40 newline).
41
42 Properties are returned in alphabetical order, with multiple properties
43 of the same name returned in the order added. (Property order is
44 unimportant in iCalendar, and this makes testing easier.)
45
46 If any mandatory property is missing, issues a warning.
47
48 The string to use as a newline can optionally be specified by giving
49 the a "crlf" argument, which defaults to "\x0d\x0a", per RFC 2445 spec;
50 this option is primarily for backwards compatability with versions of
51 this module before 0.16.
52
53 add_entry $entry
54 Adds an entry to this entry. (According to the standard, this should
55 only be called on either a to-do or event entry with an alarm entry, or
56 on a calendar entry (Data::ICal) with a to-do, event, journal,
57 timezone, or free/busy entry.)
58
59 Returns true if the entry was successfully added, and false otherwise
60 (perhaps because you tried to add an entry of an invalid type, but this
61 check hasn't been implemented yet).
62
63 entries
64 Returns a reference to the array of subentries of this entry.
65
66 properties
67 Returns a reference to the hash of properties of this entry. The keys
68 are property names and the values are array references containing
69 Data::ICal::Property objects.
70
71 property
72 Given a property name returns a reference to the array of
73 Data::ICal::Property objects.
74
75 add_property $propname => $propval
76 Creates a new Data::ICal::Property object with name $propname and value
77 $propval and adds it to the event.
78
79 If the property is not known to exist for that object type and does not
80 begin with "X-", issues a warning.
81
82 If the property is known to be unique, replaces the original property.
83
84 To specify parameters for the property, let $propval be a two-element
85 array reference where the first element is the property value and the
86 second element is a hash reference. The keys of the hash are parameter
87 names; the values should be either strings or array references of
88 strings, depending on whether the parameter should have one or multiple
89 (to be comma-separated) values.
90
91 Examples of setting parameters:
92
93 # Add a property with a parameter of VALUE set to 'DATE'
94 $event->add_property( rdate => [ $date, { VALUE => 'DATE' } ] );
95
96 add_properties $propname1 => $propval1, [$propname2 => $propname2, ...]
97 Convenience function to call "add_property" several times with a list
98 of properties.
99
100 This method is guaranteed to call add "add_property" on them in the
101 order given, so that unique properties given later in the call will
102 take precedence over those given earlier. (This is unrelated to the
103 order of properties when the entry is rendered as a string, though.)
104
105 Parameters for the properties are specified in the same way as in
106 "add_property".
107
108 mandatory_unique_properties
109 Subclasses should override this method (which returns an empty list by
110 default) to provide a list of lower case strings identifying the
111 properties which must appear exactly once in the subclass's entry type.
112
113 mandatory_repeatable_properties
114 Subclasses should override this method (which returns an empty list by
115 default) to provide a list of lower case strings identifying the
116 properties which must appear at least once in the subclass's entry
117 type.
118
119 optional_unique_properties
120 Subclasses should override this method (which returns an empty list by
121 default) to provide a list of lower case strings identifying the
122 properties which must appear at most once in the subclass's entry type.
123
124 optional_repeatable_properties
125 Subclasses should override this method (which returns an empty list by
126 default) to provide a list of lower case strings identifying the
127 properties which may appear zero, one, or more times in the subclass's
128 entry type.
129
130 is_property $name
131 Returns a boolean value indicating whether or not the property $name is
132 known to the class (that is, if it's listed in
133 "(mandatory/optional)_(unique/repeatable)_properties").
134
135 is_mandatory $name
136 Returns a boolean value indicating whether or not the property $name is
137 known to the class as mandatory (that is, if it's listed in
138 "mandatory_(unique/repeatable)_properties").
139
140 is_optional $name
141 Returns a boolean value indicating whether or not the property $name is
142 known to the class as optional (that is, if it's listed in
143 "optional_(unique/repeatable)_properties").
144
145 is_unique $name
146 Returns a boolean value indicating whether or not the property $name is
147 known to the class as unique (that is, if it's listed in
148 "(mandatory/optional)_unique_properties").
149
150 is_repeatable $name
151 Returns a boolean value indicating whether or not the property $name is
152 known to the class as repeatable (that is, if it's listed in
153 "(mandatory/optional)_repeatable_properties").
154
155 ical_entry_type
156 Subclasses should override this method to provide the identifying type
157 name of the entry (such as "VCALENDAR" or "VTODO").
158
159 vcal10 [$bool]
160 Gets or sets a boolean saying whether this entry should be interpreted
161 as vCalendar 1.0 (as opposed to iCalendar 2.0). Generally, you can
162 just set this on your main Data::ICal object when you construct it;
163 "add_entry" automatically makes sure that sub-entries end up with the
164 same value as their parents.
165
166 header
167 Returns the header line for the entry (including trailing newline).
168
169 footer
170 Returns the footer line for the entry (including trailing newline).
171
172 parse_object
173 Translate a Text::vFile::asData sub object into the appropriate
174 Data::iCal::Event subtype.
175
177 Jesse Vincent "<jesse@bestpractical.com>" with David Glasser, Simon
178 Wistow, and Alex Vandiver
179
181 Copyright (c) 2005 - 2009, Best Practical Solutions, LLC. All rights
182 reserved.
183
184 This module is free software; you can redistribute it and/or modify it
185 under the same terms as Perl itself. See perlartistic.
186
188 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
189 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
190 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
191 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
192 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
193 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
194 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
195 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
196 NECESSARY SERVICING, REPAIR, OR CORRECTION.
197
198 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
199 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
200 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
201 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
202 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
203 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
204 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
205 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
206 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
207 DAMAGES.
208
209
210
211perl v5.12.0 2009-07-10 Data::ICal::Entry(3)