/usr/share/doc/libtie-ical-perl/examples/uniquify.pl is in libtie-ical-perl 0.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | use Tie::iCal;
unlink "unique.ics", "nonunique.ics";
open ICS, ">nonunique.ics";
while (<main::DATA>) { print ICS $_ }
close ICS;
tie %events, 'Tie::iCal', "nonunique.ics", 'debug' => 0 or die "Failed to tie file!\n";
tie %newevents, 'Tie::iCal', "unique.ics", 'debug' => 0 or die "Failed to tie file!\n";
print STDERR "Converting nonunique.ics to unique.ics..\n";
while (($uid, $event) = each %events) {
my $newuid = createUniqueID(\%events);
print STDERR "Converting old key $uid to new key $newuid..\n";
$newevents{$newuid} = $event;
}
print STDERR "done\n";
untie %events;
untie %newevents;
exit;
# modified mozilla recipe
#
sub createUniqueID {
my $href = shift;
my $newID = "";
while ($newID eq "" || exists $$href{$newID}) {
$newID = int(900000000 + rand(100000000));
}
return $newID;
}
__END__
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Numen Inest/NONSGML Tie::iCal 0.11//EN
BEGIN:VEVENT
UID:9999
SUMMARY:My Event
DTSTART;VALUE=DATE:20031225
DTEND;VALUE=DATE:20031226
END:VEVENT
BEGIN:VEVENT
UID:9999
SUMMARY:My Event
DTSTART;VALUE=DATE:20031225
DTEND;VALUE=DATE:20031226
END:VEVENT
BEGIN:VEVENT
UID:9999
SUMMARY:My Event
DTSTART;VALUE=DATE:20031225
DTEND;VALUE=DATE:20031226
END:VEVENT
BEGIN:VEVENT
UID:9999
SUMMARY:My Event
DTSTART;VALUE=DATE:20031225
DTEND;VALUE=DATE:20031226
END:VEVENT
BEGIN:VEVENT
UID:9999
SUMMARY:My Event
DTSTART;VALUE=DATE:20031225
DTEND;VALUE=DATE:20031226
END:VEVENT
BEGIN:VEVENT
UID:9999
SUMMARY:My Event
DTSTART;VALUE=DATE:20031225
DTEND;VALUE=DATE:20031226
END:VEVENT
END:VCALENDAR
|