--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use Data::ICal;
+use Getopt::Long;
+use Date::Manip;
+
+my $start = undef;
+my $end = undef;
+
+GetOptions(
+ 'start' => \$start,
+ 'end' => \$end,
+);
+
+$start ||= UnixDate(ParseDate('last month'), '%Y-%m-01');
+$end ||= UnixDate(ParseDate('now'), '%Y-%m-01');
+
+$start = ParseDate($start);
+$end = ParseDate($end);
+
+my $filename = shift;
+
+die "Please tell me a filename to work on!\n"
+ unless defined $filename;
+die "I can't find the file: $filename\n"
+ unless -f $filename;
+
+print "Processing date range: " . UnixDate($start, '%Y-%m-%d') . " - " . UnixDate($end, '%Y-%m-%d') . "\n";
+
+my $calendar = Data::ICal->new(filename => $filename);
+
+use Data::Dumper;
+for my $entry (@{ $calendar->entries() }) {
+ if ($entry->ical_entry_type eq 'VEVENT') {
+ my $summary = return_property($entry, 'Summary');
+ my $description = return_property($entry, 'Description');
+ my $dtstart = return_property($entry, 'dtstart');
+ print "event: $summary - $dtstart - $description\n";
+ #print Dumper($entry);
+ } else {
+ print "not event\n";
+ }
+}
+
+sub return_property {
+ my $entry = shift;
+ my $property = shift;
+
+ my $properties = $entry->property($property);
+
+ return ""
+ unless defined $properties;
+
+ if (scalar(@{ $properties }) > 0) {
+ return @{ $properties }[0]->value();
+ } else {
+ return "";
+ }
+}