Subject: | 'add_event' assumes 'UID' but I'm not sure it's required? |
Date: | Sun, 18 Apr 2010 10:00:32 +1000 |
To: | bug-iCal-Parser [...] rt.cpan.org |
From: | Nathan Bailey <Nathan.Bailey [...] its.monash.edu> |
Line 309 of Parser.pm assumes the existence of a 'UID' attribute, but
it isn't clear to me (from http://www.ietf.org/rfc/rfc2445.txt) that
UID is a required attribute?
309: $self->find_day($event->{DTSTART})->{$event->{UID}}=$event;
The following perl script (based on Data::ICal::Entry::Event's POD),
doesn't generate a UID as part of the event:
use Data::ICal;
use Data::ICal::Entry::Event;
use Date::ICal;
my $calendar = Data::ICal->new();
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);
print $calendar->as_string;
(in fact, Data::ICal doesn't seem to have an UID generating code -
otherwise I'd use it to overcome this :-)
I would be happy if Parser.pm created UIDs as part of its parsing
process, but if you don't want to change the integrity of the original
iCal content, perhaps you could use a different (internal) key?
thanks! :-)
N