libdata-ical-perl-0.22+dfsg.orig/0000755000175000017500000000000012562720225014366 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/README0000644000175000017500000001370111225533622015246 0ustar fsfsNAME Data::ICal - Generates iCalendar (RFC 2445) calendar files INSTALLATION perl Makefile.PL make make test make install 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; DESCRIPTION A Data::ICal object represents a "VCALENDAR" object as defined in the iCalendar protocol (RFC 2445, MIME type "text/calendar"), as implemented in many popular calendaring programs such as Apple's iCal. Each Data::ICal object is a collection of "entries", which are objects of a subclass of Data::ICal::Entry. The types of entries defined by iCalendar (which refers to them as "components") include events, to-do items, journal entries, free/busy time indicators, and time zone descriptors; in addition, events and to-do items can contain alarm entries. (Currently, Data::ICal only implements to-do items and events.) Data::ICal is a subclass of Data::ICal::Entry; see its manpage for more methods applicable to Data::ICal. METHODS new [ data => $data, ] [ filename => $file ], [ vcal10 => $bool ] Creates a new Data::ICal object. If it is given a filename or data argument is passed, then this parses the content of the file or string into the object. If the "vcal10" flag is passed, parses it according to vCalendar 1.0, not iCalendar 2.0; this in particular impacts the parsing of continuation lines in quoted-printable sections. If a filename or data argument is not passed, this just sets its "VERSION" and "PRODID" properties to "2.0" (or "1.0" if the "vcal10" flag is passed) and the value of the "product_id" method respectively. Returns a false value upon failure to open or parse the file or data; this false value is a Class::ReturnValue object and can be queried as to its "error_message". parse [ data => $data, ] [ filename => $file, ] Parse a ".ics" file or string containing one, and populate $self with its contents. Should only be called once on a given object, and 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; this 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. product_id Returns the product ID used in the calendar's "PRODID" property; you may wish to override this in a subclass for your own application. 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. BUGS AND LIMITATIONS Data::ICal does not support time zone daylight or standard entries, so time zone components are basically useless. While Data::ICal tries 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::ICal does not check to see if property parameter names are known in general or allowed on the particular property. Data::ICal does 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::ICal is quoted printable. There is no Data::ICal::Entry::Alarm base class. Please report any bugs or feature requests to "bug-data-ical@rt.cpan.org", or through the web interface at . AUTHOR Jesse Vincent "" with David Glasser, Simon Wistow, and Alex Vandiver LICENCE AND COPYRIGHT Copyright (c) 2005 - 2009, 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. DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. libdata-ical-perl-0.22+dfsg.orig/Changes0000644000175000017500000000456012470565662015700 0ustar fsfsRevision history for Data-ICal 0.22 2015-02-17 - Add URI and NONE alarm types, for compatibility with Apple iCal - Add support for the common X-WR-CalName property - Optionally enforce UID attribute - Optionally auto-generate UID - Run with taint mode enabled - Packaging updates 0.21 2013-07-03 - Examine properties in consistent order, so tests pass on 5.18 and above 0.20 2013-05-01 - Properly restrict the valid properties when iCal version 1.0 (Ashley Willis) 0.19 2012-12-03 - Always output the VERSION property first 0.18 2011-12-05 - Spelling fixes from Debian (Salvatore Bonaccorso) 0.17 2011-11-27 - Allow chaining of methods (H.Merijn Brand) - Allow properties and entries in constructor (H.Merijn Brand) 0.16 2009-07-10 - Use \r\n as the newline character, per RFC 3445 - Escaping of \ was being done incorrectly, and tested incorrectly - Remove a useless and incorrect "escape code" - Mention Data::ICal::DateTime (patch from Mark Stosberg) - Update copyright - POD cleanup - Update README from POD - POD nits; mostly reflowing and whitespace fixes - Perltidy 0.15 2009-03-02 - Escaping fixes 0.14 2008-04-07 - No longer explodes if your .ics file lacks a VERSION property - Perl 5.11 adds additional strictures. Patch from ANDK to deal [rt.cpan.org #34717] 0.13 2007-03-14 - We now ignore blank lines in parsed files (by ignoring null properties when adding them to a data structure) - ical2html example script contributed by Tatsuhiko Miyagawa 0.12 2007-01-12 - Better handling of properties that should read "0" - Patch from Duncan Forsyth - Removed the note about Google and weird folding behaviour 0.11 2006-11-27 - Added the ability to not fold the output, to appease the great Google-monster 0.10 2006-10-15 - Fix the test suite to stop assuming version numbers 0.09 2006-10-15 - Quieted down ::Property when you passed in undef strings. 0.08 2006-09-16 - Fix escaping within the recur type 0.07 2006-01-24 - Doc patches from MARKSTOS - Proper quoting in properties, from MARKSTOS 0.05 2005-10-06 - Fixed a signature file 0.04 2005-08-30 - Better roundtripping to .ics 0.03 2005-08-15 - Can parse strings, not just files (this is an incompatible API change) 0.02 2005-08-03 - Parser support, thanks to Simon Wistow - Full Time Zone support 0.01 2005-07-27 - Initial release libdata-ical-perl-0.22+dfsg.orig/doc/0000755000175000017500000000000012562720225015133 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/examples/0000755000175000017500000000000012470566252016212 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/examples/ical2html.pl0000644000175000017500000000777311225501241020424 0ustar fsfs#!/usr/bin/perl # # Contributed by: Tatsuhiko Miyagawa # use strict; use warnings; use Data::ICal; use DateTime; use DateTime::Format::ISO8601; use List::Util qw(min max); use Math::BigInt; my $axis = 15; # 15 minutes my @events = map { my $cal = Data::ICal->new(filename => $_); @{$cal->entries}; } @ARGV; my $iso8601 = DateTime::Format::ISO8601->new; my(%dates, %where); for my $event (@events) { next unless $event->ical_entry_type eq 'VEVENT'; $event->{__dtstart} = $iso8601->parse_datetime( prop($event, 'DTSTART') ); $event->{__dtend} = $iso8601->parse_datetime( prop($event, 'DTEND') ); my $loc = prop($event, 'LOCATION'); push @{$dates{$event->{__dtstart}->ymd}{$loc}}, $event; $where{$loc}++; } for my $date (keys %dates) { for my $loc (keys %{$dates{$date}}) { @{$dates{$date}{$loc}} = sort { $a->{__dtstart} cmp $b->{__dtstart} } @{$dates{$date}{$loc}}; } my @events = values %{$dates{$date}}; my $start = (sort(map $_->[0]->{__dtstart}, @events))[0]; my $end = (sort(map $_->[-1]->{__dtend}, @events))[-1]; my $unit = determine_unit(map @$_, @events); my $output; $output = qq(

) . $start->strftime('%b %d, %Y') . qq(

\n); $output .= qq(\n); my $locmap = location_map(); for my $loc ( sort { $locmap->{$a} <=> $locmap->{$b} } keys %where) { $output .= qq(); } $output .= qq(\n); my $curr = $start->clone; my $fill_slots; while ($curr < $end) { $output .= qq(); if ($curr->delta_ms($start)->minutes % $axis == 0) { use integer; my $row = $axis / $unit; $output .= qq(); } for my $loc ( sort { $locmap->{$a} <=> $locmap->{$b} } keys %where ) { my $event_per_loc = $dates{$date}{$loc}; if ($event_per_loc->[0] && $event_per_loc->[0]->{__dtstart} <= $curr) { use integer; my $event = shift @$event_per_loc; my @stuff = split / \- /, prop($event, 'SUMMARY'); my $author = pop @stuff if @stuff >= 2; my $title = join " - ", @stuff; my $url = prop($event, 'URL'); my $row = $event->{__dtend}->delta_ms($event->{__dtstart})->delta_minutes / $unit; $output .= qq(); $fill_slots->{$loc} = $row - 1; } elsif ($fill_slots->{$loc}) { $fill_slots->{$loc}--; } else { my $next = $event_per_loc->[0] ? $event_per_loc->[0]->{__dtstart} : $end; my $label = $event_per_loc->[0] ? '(break)' : '(empty)'; my $row = $next->delta_ms($curr)->delta_minutes / $unit; $output .= qq(); # break $fill_slots->{$loc} = $row - 1; } } $curr->add( minutes => $unit ); $output .= qq(\n); } $output .= qq(
Time$loc
) . $curr->strftime('%H:%M') . qq(); $output .= qq($title); $output .= qq(
$author) if $author; $output .= qq(
$label
\n); print $output; } sub location_map { return { 'Tsuda Hall' => 0, 'T101+102' => 1, }; } sub determine_unit { my @events = @_; my @dates = sort map { $_->{__dtstart}, $_->{__dtend} } @events; my(@diffs, $prev); for my $date (@dates) { if ($prev) { my $diff = $date->delta_ms($prev); if ($prev and $diff->delta_minutes) { push @diffs, $diff->delta_minutes; } } $prev = $date; } return Math::BigInt::bgcd(@diffs)->numify; } sub prop { my($event, $key) = @_; my $v = $event->property($key) or return; $v->[0]->value; } libdata-ical-perl-0.22+dfsg.orig/SIGNATURE0000644000175000017500000001066012470566252015663 0ustar fsfsThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 235bb5b73789953b46e47f314e8ad5151acce1f9 .shipit SHA1 4c9e53558a6dbc3a40ecb52bbc526a6d937a477b Changes SHA1 f7c8ae3700309058e19618cf3286b824ba20e159 MANIFEST SHA1 fa12086c9dd047fd1d090dd2b726a01cc04ed6bd META.yml SHA1 47e31537a23d060ed70e3b3c4d014c00f0f33d4b Makefile.PL SHA1 ec8bde7d78141c610ceeb9f8f74d48dfca294406 README SHA1 53368d91c157d1932b76db94854288903ae7ec59 doc/rfc2445.txt SHA1 1ca8755782cececa8cb19deddbcbe03be8e73cfc examples/ical2html.pl SHA1 10f1ba97180b54e94ab30d9efe4aaa0a70aa1e26 inc/Module/AutoInstall.pm SHA1 d2664c57b65686abbfbbe1e71229761625be4922 inc/Module/Install.pm SHA1 b084961275ae4b66a9a0766372b0a08803aa63d1 inc/Module/Install/AutoInstall.pm SHA1 da41a8d9904f7b409b49a5f6c338d3eb305a2b4b inc/Module/Install/Base.pm SHA1 0db0afe19cd298abba248fa089e5525bd5ab3ab6 inc/Module/Install/Can.pm SHA1 e7152bfd5ca67d0e33f96d09c59d600bca5c1f15 inc/Module/Install/Fetch.pm SHA1 bd2183c72617105d0b65f3ef81d013bf4af337d6 inc/Module/Install/Include.pm SHA1 29ee1cb0dc262b00983e3a2f5cf00b538dff5069 inc/Module/Install/Makefile.pm SHA1 e963f80cfe255f16e55067d1feb6841cff3ed2fe inc/Module/Install/Metadata.pm SHA1 65a1f09af1f4f9e47a98b6b45667c328b1b2f9c0 inc/Module/Install/Win32.pm SHA1 f191c49475b3f51775180cd4f7e41e3bdab7f85a inc/Module/Install/WriteAll.pm SHA1 81c4f06af61b620f2923c2243901f628a6675f50 lib/Data/ICal.pm SHA1 feb8209da2105652a8e4d4b8fb3bc9581a8d7b74 lib/Data/ICal/Entry.pm SHA1 2803481758009f66e096afa3d91626673970922f lib/Data/ICal/Entry/Alarm.pm SHA1 e84b1c79549b3f9279277cc4a9f44448d1cefd7f lib/Data/ICal/Entry/Alarm/Audio.pm SHA1 5f51e155a9f450c902e366cee93015a2ae0d900b lib/Data/ICal/Entry/Alarm/Display.pm SHA1 d1d2e1f3f3a346d0b617a548b517bf63fcdb3331 lib/Data/ICal/Entry/Alarm/Email.pm SHA1 0c0e4a91f7db859a2db9c8b60c67decf6904b1dd lib/Data/ICal/Entry/Alarm/None.pm SHA1 dd21809687792ac7e69f042eda03b0a72b54d0e1 lib/Data/ICal/Entry/Alarm/Procedure.pm SHA1 dcb93443ab59b9f40430750aecb77212f9e75682 lib/Data/ICal/Entry/Alarm/URI.pm SHA1 916bb3345aebfc323695ba88eb084c785c4b35a2 lib/Data/ICal/Entry/Event.pm SHA1 8064bcb0682d328a6416d87cb22c0b8002a4c88a lib/Data/ICal/Entry/FreeBusy.pm SHA1 cf397568e16ae4587e2dda22e627f0550543e609 lib/Data/ICal/Entry/Journal.pm SHA1 49e67d4a297668372912178128ba57e4e1746443 lib/Data/ICal/Entry/TimeZone.pm SHA1 a96e10f861fcb12cccadd209c0f38da9ba059320 lib/Data/ICal/Entry/TimeZone/Daylight.pm SHA1 dd46f62ef99d926d3e0ef33cf417ef230e66707e lib/Data/ICal/Entry/TimeZone/Standard.pm SHA1 15a6d5aded4edac787ed42c14553c8a588ac23d8 lib/Data/ICal/Entry/Todo.pm SHA1 6e4030477e12b751b9cf0c29ba6bd3d596189321 lib/Data/ICal/Property.pm SHA1 371dc48be4670c99ffa5f732e7d7584465e39edc t/00.load.t SHA1 33d5621be343fcf0a596391bafba78f4b59b04ba t/01.simplegen.t SHA1 0ef26a49106e23a1a99e77f48b18e94a002ca350 t/02.linewrap.t SHA1 7aec87bcc3d62d762a2ec4adfaf120016fa1e3e0 t/03.unknown-props.t SHA1 1b8e8dde570944000c11b1ac7bdfe44bcdda96ab t/04.mandatory-props.t SHA1 e96acd335c8651c924bb2132fd53140fa0423d9c t/05.prop-params.t SHA1 e19a41be80213d3a306738f074992457623aa200 t/06.prop-bad-quote.t SHA1 6a3f262179361be328ae6ba4a6c9b0f63b4fa2b9 t/07.roundtrip.t SHA1 1d27dd46b94878b7494701eb143393f0438675c0 t/08.parse.t SHA1 69fce006e3f65f2dfc3c028126d7052cdc676dbb t/09.mime.t SHA1 e82bdabfb8322259de9c583fc5c161c4a1d0dcd1 t/10.mime-vcal10.t SHA1 b21127ca78036efd5296828b7f9d76c9c2d8f4da t/11.crlf.t SHA1 4296bf4950cffca77098c8c85562c444e9c0f897 t/12.verson1.t SHA1 21854f472cd60fd9ce6f88872691f2a744e0af5e t/ics/badlyformed.ics SHA1 3157614223f00a48699992314b1d48946fc45af7 t/ics/noversion.ics SHA1 7ad07fa3318aec73b0fe97ccbb8caa1d35b63927 t/ics/test.ics SHA1 4ff82f77563bdd06b4aec84830238b4535cfd07a t/ics/version1.ics SHA1 6da39b48ce64b584e4c3274bff96fc76ff484820 t/pod-coverage.t SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlTi7KoACgkQMflWJZZAbqAP1ACgoLpNT7lOyQzlTx/McDJInVOl VbAAn2jrGQ2NmyfRnBXEYRbCW0rDUP3r =flwi -----END PGP SIGNATURE----- libdata-ical-perl-0.22+dfsg.orig/META.yml0000644000175000017500000000134112470566252015644 0ustar fsfs--- abstract: 'Generates iCalendar (RFC 2445) calendar files' author: - 'Best Practical Solutions, LLC ' build_requires: ExtUtils::MakeMaker: 6.36 Test::LongString: 0 Test::More: 0 Test::NoWarnings: 0 Test::Warn: 0 configure_requires: ExtUtils::MakeMaker: 6.36 distribution_type: module dynamic_config: 1 generated_by: 'Module::Install version 1.14' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Data-ICal no_index: directory: - examples - inc - t requires: Class::Accessor: 0 Class::ReturnValue: 0 MIME::QuotedPrint: 0 Text::vFile::asData: 0 resources: license: http://dev.perl.org/licenses/ version: '0.22' libdata-ical-perl-0.22+dfsg.orig/MANIFEST0000644000175000017500000000240112562720225015514 0ustar fsfs.shipit Changes examples/ical2html.pl inc/Module/AutoInstall.pm inc/Module/Install.pm inc/Module/Install/AutoInstall.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm lib/Data/ICal.pm lib/Data/ICal/Entry.pm lib/Data/ICal/Entry/Alarm.pm lib/Data/ICal/Entry/Alarm/Audio.pm lib/Data/ICal/Entry/Alarm/Display.pm lib/Data/ICal/Entry/Alarm/Email.pm lib/Data/ICal/Entry/Alarm/None.pm lib/Data/ICal/Entry/Alarm/Procedure.pm lib/Data/ICal/Entry/Alarm/URI.pm lib/Data/ICal/Entry/Event.pm lib/Data/ICal/Entry/FreeBusy.pm lib/Data/ICal/Entry/Journal.pm lib/Data/ICal/Entry/TimeZone.pm lib/Data/ICal/Entry/TimeZone/Daylight.pm lib/Data/ICal/Entry/TimeZone/Standard.pm lib/Data/ICal/Entry/Todo.pm lib/Data/ICal/Property.pm Makefile.PL MANIFEST This list of files META.yml README SIGNATURE t/00.load.t t/01.simplegen.t t/02.linewrap.t t/03.unknown-props.t t/04.mandatory-props.t t/05.prop-params.t t/06.prop-bad-quote.t t/07.roundtrip.t t/08.parse.t t/09.mime.t t/10.mime-vcal10.t t/11.crlf.t t/12.verson1.t t/ics/badlyformed.ics t/ics/noversion.ics t/ics/test.ics t/ics/version1.ics t/pod-coverage.t t/pod.t libdata-ical-perl-0.22+dfsg.orig/lib/0000755000175000017500000000000012470566252015142 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/lib/Data/0000755000175000017500000000000012470566252016013 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/0000755000175000017500000000000012470566252016623 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry.pm0000644000175000017500000004214412470565650020270 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry; use base qw/Class::Accessor/; use Data::ICal::Property; use Sys::Hostname qw(); # For unique UIDs for entries use Carp; use constant CRLF => "\x0d\x0a"; =head1 NAME Data::ICal::Entry - Represents an entry in an iCalendar file =head1 SYNOPSIS my $vtodo = Data::ICal::Entry::Todo->new(); $vtodo->add_property( # ... see Data::ICal::Entry::Todo documentation ); $vtodo->add_properties( ... ); $calendar->add_entry($vtodo); $event->add_entry($alarm); $event->add_entries($alarm1, ...); # or all in one go my $vtodo = Data::ICal::Entry::Todo->new( \%props, \@entries ); =head1 DESCRIPTION A L object represents a single entry in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) iCalendar defines several types of entries, such as events and to-do lists; each of these corresponds to a subclass of L (though only to-do lists and events are currently implemented). L should be treated as an abstract base class -- all objects created should be of its subclasses. The entire calendar itself (the L object) is also represented as a L object. Each entry has an entry type (such as C or C), a series of "properties", and possibly some sub-entries. (Only the root L object can have sub-entries, except for alarm entries contained in events and to-dos (not yet implemented).) =head1 METHODS =cut =head2 new Creates a new entry object with no properties or sub-entries. =cut sub new { my $class = shift; my $self = $class->SUPER::new(); # ALLOW passing arguments here! $self->set( properties => {} ); $self->set( entries => [] ); for (@_) { ref $_ eq "HASH" and $self->add_properties( %$_ ); ref $_ eq "ARRAY" and $self->add_entries( @$_ ); } return $self; } =head2 as_string [ crlf => C ] Returns the entry as an appropriately formatted string (with trailing newline). Properties are returned in alphabetical order, with multiple properties of the same name returned in the order added. (Property order is unimportant in iCalendar, and this makes testing easier.) If any mandatory property is missing, issues a warning. The string to use as a newline can optionally be specified by giving the a C argument, which defaults to C<\x0d\x0a>, per RFC 2445 spec; this option is primarily for backwards compatibility with versions of this module before 0.16. =cut my $uid = 0; sub as_string { my $self = shift; my %args = ( crlf => CRLF, @_ ); my $output = $self->header(%args); my @mandatory = ( $self->mandatory_unique_properties, $self->mandatory_repeatable_properties, ); if (grep {$_ eq "uid"} @mandatory and !defined $self->properties->{uid} and $self->auto_uid) { # Per the RFC, create a "persistent, globally unique" UID for this # event; "persistent" in this context does not mean consistent # across time, but rather "unique across all time" $self->add_property( uid => time() . '-' .$$ . '-' . $uid++ . '@' . Sys::Hostname::hostname() ); } for my $name ( @mandatory ) { carp "Mandatory property for " . ( ref $self ) . " missing: $name" unless $self->properties->{$name} and @{ $self->properties->{$name} }; } my @properties = sort { # RFC2445 implies an order (see 4.6 Calendar Components) but does not # require it. However, some applications break if VERSION is not first # (see http://icalvalid.cloudapp.net/Default.aspx and [rt.cpan.org # #65447]). return -1 if $a eq 'version'; return 1 if $b eq 'version'; return $a cmp $b; } keys %{ $self->properties }; for my $name (@properties) { $output .= $_ for map { $_->as_string(%args) } @{ $self->properties->{$name} }; } for my $entry ( @{ $self->entries } ) { $output .= $entry->as_string(%args); } $output .= $self->footer(%args); return $output; } =head2 add_entry $entry Adds an entry to this entry. (According to the standard, this should only be called on either a to-do or event entry with an alarm entry, or on a calendar entry (L) with a to-do, event, journal, timezone, or free/busy entry.) Returns true if the entry was successfully added, and false otherwise (perhaps because you tried to add an entry of an invalid type, but this check hasn't been implemented yet). =cut sub add_entry { my $self = shift; my $entry = shift; push @{ $self->{entries} }, $entry; $entry->vcal10( $self->vcal10 ); $entry->rfc_strict( $self->rfc_strict ); $entry->auto_uid( $self->auto_uid ); return $self; } =head2 add_entries $entry1, [$entry2, ...] Convenience function to call C several times with a list of entries. =cut sub add_entries { my $self = shift; $self->add_entry( $_ ) for @_; return $self; } =head2 entries Returns a reference to the array of subentries of this entry. =cut __PACKAGE__->mk_ro_accessors('entries'); =head2 properties Returns a reference to the hash of properties of this entry. The keys are property names and the values are array references containing L objects. =cut __PACKAGE__->mk_ro_accessors('properties'); =head2 property Given a property name returns a reference to the array of L objects. =cut sub property { my $self = shift; my $prop = lc shift; return $self->{'properties'}->{$prop}; } =head2 add_property $propname => $propval Creates a new L object with name C<$propname> and value C<$propval> and adds it to the event. If the property is not known to exist for that object type and does not begin with C, issues a warning. If the property is known to be unique, replaces the original property. To specify parameters for the property, let C<$propval> be a two-element array reference where the first element is the property value and the second element is a hash reference. The keys of the hash are parameter names; the values should be either strings or array references of strings, depending on whether the parameter should have one or multiple (to be comma-separated) values. Examples of setting parameters: # Add a property with a parameter of VALUE set to 'DATE' $event->add_property( rdate => [ $date, { VALUE => 'DATE' } ] ); =cut sub add_property { my $self = shift; my $prop = lc shift; my $val = shift; return unless defined $prop; unless ( $self->is_property($prop) or $prop =~ /^x-/i ) { carp "Unknown property for " . ( ref $self ) . ": $prop"; } if ( $self->is_unique($prop) ) { # It should be unique, so clear out anything we might have first $self->properties->{$prop} = []; } $val = [ $val, {} ] unless ref $val eq 'ARRAY'; my ( $prop_value, $param_hash ) = @$val; my $p = Data::ICal::Property->new( $prop => $prop_value, $param_hash ); $p->vcal10( $self->vcal10 ); push @{ $self->properties->{$prop} }, $p; return $self; } =head2 add_properties $propname1 => $propval1, [$propname2 => $propname2, ...] Convenience function to call C several times with a list of properties. This method is guaranteed to call add C on them in the order given, so that unique properties given later in the call will take precedence over those given earlier. (This is unrelated to the order of properties when the entry is rendered as a string, though.) Parameters for the properties are specified in the same way as in C. =cut sub add_properties { my $self = shift; if ( @_ % 2 ) { carp "Odd number of elements in add_properties call"; return; } while (@_) { my $prop = shift; my $val = shift; $self->add_property( $prop => $val ); } return $self; } =head2 mandatory_unique_properties Subclasses should override this method (which returns an empty list by default) to provide a list of lower case strings identifying the properties which must appear exactly once in the subclass's entry type. =cut sub mandatory_unique_properties { () } =head2 mandatory_repeatable_properties Subclasses should override this method (which returns an empty list by default) to provide a list of lower case strings identifying the properties which must appear at least once in the subclass's entry type. =cut sub mandatory_repeatable_properties { () } =head2 optional_unique_properties Subclasses should override this method (which returns an empty list by default) to provide a list of lower case strings identifying the properties which must appear at most once in the subclass's entry type. =cut sub optional_unique_properties { () } =head2 optional_repeatable_properties Subclasses should override this method (which returns an empty list by default) to provide a list of lower case strings identifying the properties which may appear zero, one, or more times in the subclass's entry type. =cut sub optional_repeatable_properties { () } =head2 is_property $name Returns a boolean value indicating whether or not the property C<$name> is known to the class (that is, if it's listed in C<(mandatory/optional)_(unique/repeatable)_properties>). =cut sub is_property { my $self = shift; my $name = shift; return scalar grep { $_ eq $name } $self->mandatory_unique_properties, $self->mandatory_repeatable_properties, $self->optional_unique_properties, $self->optional_repeatable_properties; } =head2 is_mandatory $name Returns a boolean value indicating whether or not the property C<$name> is known to the class as mandatory (that is, if it's listed in C). =cut sub is_mandatory { my $self = shift; my $name = shift; return scalar grep { $_ eq $name } $self->mandatory_unique_properties, $self->mandatory_repeatable_properties; } =head2 is_optional $name Returns a boolean value indicating whether or not the property C<$name> is known to the class as optional (that is, if it's listed in C). =cut sub is_optional { my $self = shift; my $name = shift; return scalar grep { $_ eq $name } $self->optional_unique_properties, $self->optional_repeatable_properties; } =head2 is_unique $name Returns a boolean value indicating whether or not the property C<$name> is known to the class as unique (that is, if it's listed in C<(mandatory/optional)_unique_properties>). =cut sub is_unique { my $self = shift; my $name = shift; return scalar grep { $_ eq $name } $self->mandatory_unique_properties, $self->optional_unique_properties; } =head2 is_repeatable $name Returns a boolean value indicating whether or not the property C<$name> is known to the class as repeatable (that is, if it's listed in C<(mandatory/optional)_repeatable_properties>). =cut sub is_repeatable { my $self = shift; my $name = shift; return scalar grep { $_ eq $name } $self->mandatory_repeatable_properties, $self->optional_repeatable_properties; } =head2 ical_entry_type Subclasses should override this method to provide the identifying type name of the entry (such as C or C). =cut sub ical_entry_type {'UNDEFINED'} =head2 vcal10 [$bool] Gets or sets a boolean saying whether this entry should be interpreted as vCalendar 1.0 (as opposed to iCalendar 2.0). Generally, you can just set this on your main L object when you construct it; C automatically makes sure that sub-entries end up with the same value as their parents. =cut __PACKAGE__->mk_accessors('vcal10'); =head2 rfc_strict [$bool] Gets or sets a boolean saying whether this entry will complain about missing UIDs as per RFC2446. Defaults to false, for backwards compatibility. Generally, you can just set this on your main L object when you construct it; C automatically makes sure that sub-entries end up with the same value as their parents. =cut __PACKAGE__->mk_accessors('rfc_strict'); =head2 auto_uid [$bool] Gets or sets a boolean saying whether this entry should automatically generate its own persistently unique UIDs. Defaults to false. Generally, you can just set this on your main L object when you construct it; C automatically makes sure that sub-entries end up with the same value as their parents. =cut __PACKAGE__->mk_accessors('auto_uid'); =head2 header Returns the header line for the entry (including trailing newline). =cut sub header { my $self = shift; my %args = ( crlf => CRLF, @_ ); return 'BEGIN:' . $self->ical_entry_type . $args{crlf}; } =head2 footer Returns the footer line for the entry (including trailing newline). =cut sub footer { my $self = shift; my %args = ( crlf => CRLF, @_ ); return 'END:' . $self->ical_entry_type . $args{crlf}; } # mapping of event types to class (under the Data::Ical::Event namespace) my %_generic = ( vevent => 'Event', vtodo => 'Todo', vjournal => 'Journal', vfreebusy => 'FreeBusy', vtimezone => 'TimeZone', standard => 'TimeZone::Standard', daylight => 'TimeZone::Daylight', ); =head2 parse_object Translate a L sub object into the appropriate L subtype. =cut # TODO: this is currently recursive which could blow the stack - # it might be worth refactoring to make it sequential sub parse_object { my ( $self, $object ) = @_; my $type = $object->{type}; my $new_self; # First check to see if it's generic long name just in case there # event turns out to be a VGENERIC entry type if ( my $class = $_generic{ lc($type) } ) { $new_self = $self->_parse_data_ical_generic( $class, $object ); # then look for specific overrides } elsif ( my $sub = $self->can( '_parse_' . lc($type) ) ) { $new_self = $self->$sub($object); # complain } else { warn "Can't parse type $type yet"; return; } # recurse through sub-objects foreach my $sub_object ( @{ $object->{objects} } ) { $new_self->parse_object($sub_object); } return $self; } # special because we want to use ourselves as the parent sub _parse_vcalendar { my ( $self, $object ) = @_; $self->_parse_generic_event( $self, $object ); return $self; } # mapping of action types to class (under the Data::Ical::Event::Alarm namespace) my %_action_map = ( AUDIO => 'Audio', DISPLAY => 'Display', EMAIL => 'Email', PROCEDURE => 'Procedure', NONE => 'None', URI => 'URI', ); # alarms have actions sub _parse_valarm { my ( $parent, $object ) = @_; # ick my $action = $object->{properties}->{ACTION}->[0]->{value}; die "Can't parse VALARM with action $action" unless exists $_action_map{$action}; $action = $_action_map{$action}; my $alarm_class = "Data::ICal::Entry::Alarm::$action"; eval "require $alarm_class"; die "Failed to require $alarm_class : $@" if $@; $alarm_class->import; my $alarm = $alarm_class->new; $parent->_parse_generic_event( $alarm, $object ); $parent->add_entry($alarm); return $alarm; } # generic event handler sub _parse_data_ical_generic { my ( $parent, $class, $object ) = @_; my $entry_class = "Data::ICal::Entry::$class"; eval "require $entry_class"; die "Failed to require $entry_class : $@" if $@; $entry_class->import; my $entry = $entry_class->new; $entry->vcal10($parent->vcal10); $parent->_parse_generic_event( $entry, $object ); $parent->add_entry($entry); return $entry; } # handle transferring of properties sub _parse_generic_event { my ( $parent, $entry, $object ) = @_; my $p = $object->{properties}; for my $key ( sort keys %$p ) { foreach my $occurence (@{ $p->{$key} }) { my $prop; # Unescapes, but only in v2, and not if it's explicitly not TEXT if (not $parent->vcal10 and ( not $occurence->{param} or not defined $occurence->{param}{VALUE} or $occurence->{param}{VALUE} eq "TEXT" ) ) { $occurence->{value} =~ s/\\([;,\\])/$1/g; $occurence->{value} =~ s/\\n/\n/ig; } # handle optional params and 'normal' key/value pairs # TODO: line wrapping? if ( $occurence->{param} ) { $prop = [ $occurence->{value}, $occurence->{param} ]; } else { $prop = $occurence->{value}; } $entry->add_property( lc($key) => $prop ); } } return $entry; } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Property.pm0000644000175000017500000002065712470565650021020 0ustar fsfsuse warnings; use strict; package Data::ICal::Property; use base qw/Class::Accessor/; use Carp; use MIME::QuotedPrint (); our $VERSION = '0.06'; =head1 NAME Data::ICal::Property - Represents a property on an entry in an iCalendar file =head1 DESCRIPTION A L object represents a single property on an entry in an iCalendar file. Properties have parameters in addition to their value. You shouldn't need to create L values directly -- just use C in L. The C parameter value is only interpreted by L in the C and C methods: all other methods access the encoded version directly (if there is an encoding). Currently, the only supported encoding is C. =head1 METHODS =cut =head2 new $key, $value, [$parameter_hash] Creates a new L with key C<$key> and value C<$value>. If C<$parameter_hash> is provided, sets the property's parameters to it. The parameter hash should have keys equal to the names of the parameters (case insensitive; parameter hashes should not contain two different keys which are the same when converted to upper case); the values should either be a string if the parameter has a single value or an array reference of strings if the parameter has multiple values. =cut sub new { my $class = shift; my $self = {}; bless $self, $class; $self->key(shift); $self->value(shift); $self->parameters( shift || {} ); return ($self); } =head2 key [$key] Gets or sets the key name of this property. =head2 value [$value] Gets or sets the value of this property. =head2 parameters [$param_hash] Gets or sets the parameter hash reference of this property. Parameter keys are converted to upper case. =head2 vcal10 [$bool] Gets or sets a boolean saying whether this should be interpreted as vCalendar 1.0 (as opposed to iCalendar 2.0). Generally, you can just set this on your main L object when you construct it; C automatically makes sure that sub-entries end up with the same value as their parents, and C makes sure that properties end up with the same value as their entry. =cut __PACKAGE__->mk_accessors(qw(key value _parameters vcal10)); sub parameters { my $self = shift; if (@_) { my $params = shift; my $new_params = {}; while ( my ( $k, $v ) = each %$params ) { $new_params->{ uc $k } = $v; } $self->_parameters($new_params); } return $self->_parameters; } my %ENCODINGS = ( 'QUOTED-PRINTABLE' => { encode => sub { my $dec = shift || ''; $dec =~ s/\n/\r\n/g; return MIME::QuotedPrint::encode( $dec, '' ); }, decode => sub { my $dec = MIME::QuotedPrint::decode( shift || '' ); $dec =~ s/\r\n/\n/g; return $dec; } }, ); =head2 decoded_value Gets the value of this property, converted from the encoding specified in its encoding parameter. (That is, C will return the encoded version; this will apply the encoding.) If the encoding is not specified or recognized, just returns the raw value. =cut sub decoded_value { my $self = shift; my $value = $self->value; my $encoding = uc( $self->parameters->{'ENCODING'} || "" ); if ( $ENCODINGS{$encoding} ) { return $ENCODINGS{$encoding}{'decode'}->($value); } else { return $value; } } =head2 encode $encoding Calls C to get the current decoded value, then encodes it in C<$encoding>, sets the value to that, and sets the encoding parameter to C<$encoding>. (C<$encoding> is first converted to upper case.) If C<$encoding> is undef, deletes the encoding parameter and sets the value to the decoded value. Does nothing if the encoding is not recognized. =cut sub encode { my $self = shift; my $encoding = uc shift; my $decoded_value = $self->decoded_value; if ( not defined $encoding ) { $self->value($decoded_value); delete $self->parameters->{'ENCODING'}; } elsif ( $ENCODINGS{$encoding} ) { $self->value( $ENCODINGS{$encoding}{'encode'}->($decoded_value) ); $self->parameters->{'ENCODING'} = $encoding; } return $self; } =head2 as_string ARGS Returns the property formatted as a string (including trailing newline). Takes named arguments: =over =item fold Defaults to true. pass in a false value if you need to generate non-rfc-compliant calendars. =item crlf Defaults to C<\x0d\x0a>, per RFC 2445 spec. This option is primarily for backwards compatibility with version of this module prior to 0.16, which used C<\x0a>. =back =cut sub as_string { my $self = shift; my %args = ( fold => 1, crlf => Data::ICal::Entry->CRLF, @_ ); my $string = uc( $self->key ) . $self->_parameters_as_string . ":" . $self->_value_as_string( $self->key ) . $args{crlf}; # Assumption: the only place in an iCalendar that needs folding are property # lines if ( $args{'fold'} ) { return $self->_fold( $string, $args{crlf} ); } return $string; } =begin private =head2 _value_as_string Returns the property's value as a string. Comma and semicolon are not escaped when the value is recur type (the key is rrule). Values are quoted according the iCal spec, unless this is in vCal 1.0 mode. =end private =cut sub _value_as_string { my $self = shift; my $key = shift; my $value = defined( $self->value() ) ? $self->value() : ''; unless ( $self->vcal10 ) { $value =~ s/\\/\\\\/gs; $value =~ s/;/\\;/gs unless lc($key) eq 'rrule'; $value =~ s/,/\\,/gs unless lc($key) eq 'rrule'; $value =~ s/\x0d?\x0a/\\n/gs; } return $value; } =begin private =head2 _parameters_as_string Returns the property's parameters as a string. Properties are sorted alphabetically to aid testing. =end private =cut sub _parameters_as_string { my $self = shift; my $out = ''; for my $name ( sort keys %{ $self->parameters } ) { my $value = $self->parameters->{$name}; $out .= ';' . $name . '=' . $self->_quoted_parameter_values( ref $value ? @$value : $value ); } return $out; } =begin private =head2 _quoted_parameter_values @values Quotes any of the values in C<@values> that need to be quoted and returns the quoted values joined by commas. If any of the values contains a double-quote, erases it and emits a warning. =end private =cut sub _quoted_parameter_values { my $self = shift; my @values = @_; for my $val (@values) { if ( $val =~ /"/ ) { # Get all the way back to the user's code local $Carp::CarpLevel = $Carp::CarpLevel + 1; carp "Invalid parameter value (contains double quote): $val"; $val =~ tr/"//d; } } return join ',', map { /[;,:]/ ? qq("$_") : $_ } @values; } =begin private =head2 _fold $string $crlf Returns C<$string> folded with newlines and leading whitespace so that each line is at most 75 characters. (Note that it folds at 75 characters, not 75 bytes as specified in the standard.) If this is vCalendar 1.0 and encoded with QUOTED-PRINTABLE, does not fold at all. =end private =cut sub _fold { my $self = shift; my $string = shift; my $crlf = shift; my $quoted_printable = $self->vcal10 && uc( $self->parameters->{'ENCODING'} || '' ) eq 'QUOTED-PRINTABLE'; if ($quoted_printable) { # In old vcal, quoted-printable properties have different folding rules. # But some interop tests suggest it's wiser just to not fold for vcal 1.0 # at all (in quoted-printable). } else { my $pos = 0; # Walk through the value, looking to replace 75 characters at # a time. We assign to pos() to update where to pick up for # the next match. while ( $string =~ s/\G(.{75})(?=.)/$1$crlf / ) { $pos += 75 + length($crlf); pos($string) = $pos; } } return $string; } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/0000755000175000017500000000000012470566252017724 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/FreeBusy.pm0000644000175000017500000000445312470565650022015 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::FreeBusy; use base qw/Data::ICal::Entry/; =head1 NAME Data::ICal::Entry::FreeBusy - Represents blocks of free and busy time in an iCalendar file =head1 SYNOPSIS my $vfreebusy = Data::ICal::Entry::FreeBusy->new(); $vfreebusy->add_properties( organizer => 'MAILTO:jsmith@host.com', # Dat*e*::ICal is not a typo here freebusy => Date::ICal->new( epoch => ... )->ical . '/' . Date::ICal->new( epoch => ... )->ical, ); $calendar->add_entry($vfreebusy); =head1 DESCRIPTION A L object represents a request for information about free and busy time or a reponse to such a request, in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) It is a subclass of L and accepts all of its methods. =head1 METHODS =cut =head2 ical_entry_type Returns C, its iCalendar entry name. =cut sub ical_entry_type {'VFREEBUSY'} =head2 mandatory_unique_properties The C property is mandatory if C was passed to L. =cut sub mandatory_unique_properties { my $self = shift; return $self->rfc_strict ? ("uid") : () } =head2 optional_unique_properties According to the iCalendar standard, the following properties may be specified at most one time for a free/busy entry: contact dtstart dtend duration dtstamp organizer uid url =cut sub optional_unique_properties { my $self = shift; my @ret = qw( contact dtstart dtend duration dtstamp organizer url ); push @ret, "uid" unless $self->rfc_strict; return @ret; } =head2 optional_repeatable_properties According to the iCalendar standard, the following properties may be specified any number of times for free/busy entry: attendee comment freebusy request-status =cut sub optional_repeatable_properties { qw( attendee comment freebusy request-status ); } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/Alarm.pm0000644000175000017500000000373012470565650021322 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::Alarm; use base qw/Data::ICal::Entry/; =head1 NAME Data::ICal::Entry::Alarm - Abstract base class for alarms =head1 DESCRIPTION L is an abstract base class for the other type of supported by alarms: =over =item L =item L =item L =item L =back It is a subclass of L and accepts all of its methods. =head1 METHODS =cut =head2 new =cut sub new { my $class = shift; my $self = $class->SUPER::new(@_); die "Can't instantiate abstract base class Data::ICal::Entry::Alarm" if $class eq __PACKAGE__; return $self; } =head2 ical_entry_type Returns C, its iCalendar entry name. =cut sub ical_entry_type {'VALARM'} =head2 optional_unique_properties According to the iCalendar standard, the C and C properties may be specified at most one time all types of alarms; if one is specified, the other one must be also, though this module does not enforce that restriction. =cut sub optional_unique_properties { qw( duration repeat ); } =head2 mandatory_unique_properties According to the iCalendar standard, the C property must be specified exactly once for an all types of alarms; subclasses may have additional required properties. In addition, the C property must be specified exactly once, but all subclasses automatically set said property appropriately. =cut sub mandatory_unique_properties { qw( action trigger ); } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/Journal.pm0000644000175000017500000000476012470565650021704 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::Journal; use base qw/Data::ICal::Entry/; =head1 NAME Data::ICal::Entry::Journal - Represents a journal entry in an iCalendar file =head1 SYNOPSIS my $vjournal = Data::ICal::Entry::Journal->new(); $vjournal->add_properties( summary => "Minutes of my party", description => "I cried because I wanted to.", # Dat*e*::ICal is not a typo here dtstart => Date::ICal->new( epoch => time )->ical, ); $calendar->add_entry($vjournal); =head1 DESCRIPTION A L object represents a single journal entry in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) It is a subclass of L and accepts all of its methods. =head1 METHODS =cut =head2 ical_entry_type Returns C, its iCalendar entry name. =cut sub ical_entry_type {'VJOURNAL'} =head2 mandatory_unique_properties The C property is mandatory if C was passed to L. =cut sub mandatory_unique_properties { my $self = shift; return $self->rfc_strict ? ("uid") : () } =head2 optional_unique_properties According to the iCalendar standard, the following properties may be specified at most one time for a journal entry: class created description dtstart dtstamp last-modified organizer recurrence-id sequence status summary uid url =cut sub optional_unique_properties { my $self = shift; my @ret = qw( class created description dtstart dtstamp last-modified organizer recurrence-id sequence status summary url ); push @ret, "uid" unless $self->rfc_strict; return @ret; } =head2 optional_repeatable_properties According to the iCalendar standard, the following properties may be specified any number of times for a journal entry: attach attendee categories comment contact exdate exrule related-to rdate rrule request-status =cut sub optional_repeatable_properties { qw( attach attendee categories comment contact exdate exrule related-to rdate rrule request-status ); } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/Todo.pm0000644000175000017500000000721512470565650021175 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::Todo; use base qw/Data::ICal::Entry/; =head1 NAME Data::ICal::Entry::Todo - Represents a to-do entry in an iCalendar file =head1 SYNOPSIS my $vtodo = Data::ICal::Entry::Todo->new(); $vtodo->add_properties( summary => "go to sleep", status => 'INCOMPLETE', # Dat*e*::ICal is not a typo here dtstart => Date::ICal->new( epoch => time )->ical, ); $calendar->add_entry($vtodo); $vtodo->add_entry($alarm); =head1 DESCRIPTION A L object represents a single to-do entry in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) It is a subclass of L and accepts all of its methods. =head1 METHODS =cut =head2 ical_entry_type Returns C, its iCalendar entry name. =cut sub ical_entry_type {'VTODO'} =head2 mandatory_unique_properties The C property is mandatory if C was passed to L. =cut sub mandatory_unique_properties { my $self = shift; return $self->rfc_strict ? ("uid") : () } =head2 optional_unique_properties According to the iCalendar standard, the following properties may be specified at most one time for a to-do item: class completed created description dtstamp dtstart geo last-modified location organizer percent-complete priority recurrence-id sequence status summary uid url In addition, C and C may be specified at most once each, but not both in the same entry (though this restriction is not enforced). Or if C<< vcal10 => 1 >>: class dcreated completed description dtstart due last-modified location rnum priority sequence status summary transp url uid =cut sub optional_unique_properties { my $self = shift; my @ret = $self->rfc_strict ? () : ("uid"); if (not $self->vcal10) { push @ret, qw( class completed created description dtstamp dtstart geo last-modified location organizer percent-complete priority recurrence-id sequence status summary uid url due duration ); } else { push @ret, qw( class dcreated completed description dtstart due last-modified location rnum priority sequence status summary transp url uid ); } return @ret; } =head2 optional_repeatable_properties According to the iCalendar standard, the following properties may be specified any number of times for a to-do item: attach attendee categories comment contact exdate exrule request-status related-to resources rdate rrule Or if C<< vcal10 => 1 >>: aalarm attach attendee categories dalarm exdate exrule malarm palarm related-to resources rdate rrule =cut sub optional_repeatable_properties { my $self = shift; if (not $self->vcal10) { qw( attach attendee categories comment contact exdate exrule request-status related-to resources rdate rrule ); } else { qw( aalarm attach attendee categories dalarm exdate exrule malarm palarm related-to resources rdate rrule ); } } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/Event.pm0000644000175000017500000000761212470565650021352 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::Event; use base qw/Data::ICal::Entry/; =head1 NAME Data::ICal::Entry::Event - Represents an event in an iCalendar file =head1 SYNOPSIS my $vevent = Data::ICal::Entry::Event->new(); $vevent->add_properties( summary => "my party", description => "I'll cry if I want to", # Dat*e*::ICal is not a typo here dtstart => Date::ICal->new( epoch => time )->ical, ); $calendar->add_entry($vevent); $vevent->add_entry($alarm); =head1 DESCRIPTION A L object represents a single event in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) It is a subclass of L and accepts all of its methods. =head1 METHODS =cut =head2 ical_entry_type Returns C, its iCalendar entry name. =cut sub ical_entry_type {'VEVENT'} =head2 mandatory_unique_properties The C property is mandatory if C was passed to L. =cut sub mandatory_unique_properties { my $self = shift; return $self->rfc_strict ? ("uid") : () } =head2 optional_unique_properties According to the iCalendar standard, the following properties may be specified at most one time for an event: class created description dtstart geo last-modified location organizer priority dtstamp sequence status summary transp uid url recurrence-id In addition, C and C may be specified at most once each, but not both in the same entry (though this restriction is not enforced). Or if C<< vcal10 => 1 >>: class dcreated completed description dtstart dtend last-modified location rnum priority sequence status summary transp url uid =cut sub optional_unique_properties { my $self = shift; my @ret = $self->rfc_strict ? () : ("uid"); if (not $self->vcal10) { push @ret, qw( class created description dtstart geo last-modified location organizer priority dtstamp sequence status summary transp url recurrence-id dtend duration ); } else { push @ret, qw( class dcreated completed description dtstart dtend last-modified location rnum priority sequence status summary transp url ); } return @ret; } =head2 optional_repeatable_properties According to the iCalendar standard, the following properties may be specified any number of times for an event: attach attendee categories comment contact exdate exrule request-status related-to resources rdate rrule Or if C<< vcal10 => 1 >>: aalarm attach attendee categories dalarm exdate exrule malarm palarm related-to resources rdate rrule =cut sub optional_repeatable_properties { my $self = shift; if (not $self->vcal10) { qw( attach attendee categories comment contact exdate exrule request-status related-to resources rdate rrule ); } else { qw( aalarm attach attendee categories dalarm exdate exrule malarm palarm related-to resources rdate rrule ); } } =head1 SEE ALSO =over 4 =item L For date parsing and formatting, including denoting "all day" events, considering using this module. Because it's a "mix in", you can still use all the methods here as well as the new date handling methods it defines. =back =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/TimeZone.pm0000644000175000017500000000367112470565650022024 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::TimeZone; use base qw/Data::ICal::Entry/; =head1 NAME Data::ICal::Entry::TimeZone - Represents a time zone definition in an iCalendar file =head1 SYNOPSIS my $vtimezone = Data::ICal::Entry::TimeZone->new(); $vtimezone->add_properties( tzid => "US-Eastern", tzurl => "http://zones.stds_r_us.net/tz/US-Eastern" ); $vtimezone->add_entry($daylight); # daylight/ standard not yet implemented $vtimezone->add_entry($standard); # :-( $calendar->add_entry($vtimezone); =head1 DESCRIPTION A L object represents the declaration of a time zone in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) It is a subclass of L and accepts all of its methods. This module is not yet useful, because every time zone declaration needs to contain at least one C or C component, and these have not yet been implemented. =head1 METHODS =cut =head2 ical_entry_type Returns C, its iCalendar entry name. =cut sub ical_entry_type {'VTIMEZONE'} =head2 optional_unique_properties According to the iCalendar standard, the following properties may be specified at most one time for a time zone declaration: last-modified tzurl =cut sub optional_unique_properties { qw( last-modified tzurl ); } =head2 mandatory_unique_properties According to the iCalendar standard, the C property must be specified exactly one time in a time zone declaration. =cut sub mandatory_unique_properties { qw( tzid ); } =head1 AUTHOR Best Practical Solutions, LLC Emodules@bestpractical.comE =head1 LICENCE AND COPYRIGHT Copyright (c) 2005 - 2015, 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 L. =cut 1; libdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/Alarm/0000755000175000017500000000000012470566252020760 5ustar fsfslibdata-ical-perl-0.22+dfsg.orig/lib/Data/ICal/Entry/Alarm/Audio.pm0000644000175000017500000000340312470565650022360 0ustar fsfsuse warnings; use strict; package Data::ICal::Entry::Alarm::Audio; use base qw/Data::ICal::Entry::Alarm/; =head1 NAME Data::ICal::Entry::Alarm::Audio - Represents an audio alarm in an iCalendar file =head1 SYNOPSIS my $valarm = Data::ICal::Entry::Alarm::Audio->new(); $valarm->add_properties( attach => [ "ftp://host.com/pub/sounds/bell-01.aud", { fmttype => "audio/basic" } ], # Dat*e*::ICal is not a typo here trigger => [ Date::ICal->new( epoch => ... )->ical, { value => 'DATE-TIME' } ], ); $vevent->add_entry($valarm); =head1 DESCRIPTION A L object represents an audio alarm attached to a todo item or event in an iCalendar file. (Note that the iCalendar RFC refers to entries as "components".) It is a subclass of L and accepts all of its methods. =head1 METHODS =cut =head2 new Creates a new L object; sets its C property to C