Data::ICal(3pm)
β¨ NAME β¨
Data::ICal β bestie, this is the module that generates iCalendar (RFC 2445) calendar files. Yes, the .ics things. Yes, the ones that make your calendar app go ποΈβ¨
π¦ SYNOPSIS π¦
use Data::ICal;
my $calendar = Data::ICal->new();
my $vtodo = Data::ICal::Entry::Todo->new();
$vtodo->add_properties(
# ... see Data::ICal::Entry::Todo documentation
);
# ... or
$calendar = Data::ICal->new(filename => 'foo.ics'); # parse existing file
$calendar = Data::ICal->new(data => 'BEGIN:VCALENDAR...'); # parse from scalar
$calendar->add_entry($vtodo);
print $calendar->as_string;
look at that. so clean. so demure. so mindful. π
πΈ DESCRIPTION πΈ
Okay so. A Data::ICal object is literally a "VCALENDAR" object, exactly as defined in the iCalendar protocol (RFC 2445, MIME type "text/calendar"), the way it's implemented in basically every popular calendaring program out there β Apple's iCal being the iconic one, iykyk.
Every single Data::ICal object is a lil collection of "entries", and those entries are objects of a subclass of Data::ICal::Entry. The entry types that iCalendar defines (it calls them "components" β different name, same vibe π
) are:
- events
- to-do items
- journal entries
- free/busy time indicators
- time zone descriptors
and on top of that, events and to-do items can also contain alarm entries. π’
β οΈ lowkey important: currently, Data::ICal only implements to-do items and events. that's it. that's the roster.
Also!! Data::ICal is a subclass of Data::ICal::Entry β so go read its manpage for all the extra methods that apply to Data::ICal too. π«Ά
π METHODS π
π new [ data => $data, ] [ filename => $file ], [ calname => $string ], [ vcal10 => $bool ], [ rfc_strict => $bool ], [ auto_uid => $bool ]
Creates a new Data::ICal object. new object, who dis β¨
- If it is given a filename or data argument, then it parses the content of the file or string into the object. If the
"vcal10"flag is passed, it parses according to vCalendar 1.0, not iCalendar 2.0 β and this in particular impacts the parsing of continuation lines in quoted-printable sections. π€ - If a calname is passed, it sets
x-wr-calnameto that string. Not specified in RFC2445, but most calendar software respectsx-wr-calnameas the displayed name of the calendar. so like. it's the calendar's nickname. π₯Ή - If the
"rfc_strict"flag is set to true,Data::ICalwill require UIDs, as per RFC2445:
4.8.4.7 Unique Identifier
... The property MUST be specified in the "VEVENT", "VTODO",
"VJOURNAL" or "VFREEBUSY" calendar components"
- If the
"auto_uid"flag is set to true, it will automatically generate a default UID for each type that requires one, based on the RFC-suggested algorithm. And if you set UID attributes explicitly? Those override the auto-generated value. periodt. - If a filename or data argument is not passed, this just sets the object's
"VERSION"and"PRODID"properties to"2.0"(or"1.0"if the"vcal10"flag is passed) plus the value of the"product_id"method respectively. π - Returns a false value upon failure to open or parse the file or data. and that false value? it's a
Class::ReturnValueobject, so you can interrogate it about its"error_message". she tells you what went wrong, we love a communicative queen. π
π¦ parse [ data => $data, ] [ filename => $file, ]
Parse a .ics file (or a string containing one) and populate $self with its contents.
π¨ bestie READ THIS: should only be called once on a given object, and it will be automatically called by"new"if you provide arguments to"new".
Returns $self on success. Returns a false value upon failure to open or parse the file or data β again, that false value is a Class::ReturnValue object and can be queried as to its "error_message". π«Ά
π ical_entry_type
Returns "VCALENDAR" β its iCalendar entry name. that's the whole method. iconic, honestly.
π product_id
Returns the product ID used in the calendar's "PRODID" property. And ngl, you may wish to override this in a subclass for your own application. main character move π
πΈ mandatory_unique_properties
According to the iCalendar standard, the following properties must be specified exactly one time for a calendar:
prodid version
π optional_unique_properties
According to the iCalendar standard, the following properties may be specified at most one time for a calendar:
calscale method
π«Ά DEPENDENCIES π«Ά
Data::ICal requires Class::Accessor, Text::vFile::asData, MIME::QuotedPrint, and Class::ReturnValue. the whole squad. π
π BUGS AND LIMITATIONS π
okay. sit down. we gotta be real for a sec. π
Data::ICaldoes not support time zone daylight or standard entries, so time zone components are basically useless. yeah. π- While
Data::ICaltries to check which properties are required and repeatable, this only works in simple cases β it does not check for properties that must either both exist or both not exist, or for mutually exclusive properties. Data::ICaldoes not check to see if property parameter names are known in general, or allowed on the particular property.Data::ICaldoes not check to see if nested entries are nested properly (alarms in todos and events only, everything else in calendars only).- The only property encoding supported by
Data::ICalis quoted printable. - Please report any bugs or feature requests to
"bug-data-ical@rt.cpan.org", or through the web interface at <http://rt.cpan.org>.
π AUTHOR π
Best Practical Solutions, LLC <modules@bestpractical.com>
π LICENCE AND COPYRIGHT π
Copyright (c) 2005 - 2020, Best Practical Solutions, LLC. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
and that's the whole page bestie!! this was written for perl v5.36.0, dated 2022-10-14, and it's the Data::ICal(3pm) manpage β go forth and calendar πππ
π¦ where this page comes from
- ubuntu noble: libdata-ical-perl 0.24+dfsg-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdata-ical-perl 0.24+dfsg-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-ical-perl 0.24+dfsg-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms