--- /dev/null
+#!/usr/bin/perl -w
+
+use v5.10;
+use LWP;
+use LWP::UserAgent;
+use Data::ICal;
+use Data::ICal::Entry::Event;
+
+
+my $url = 'http://calendar.etc.gen.nz/freebusy.php/susanne';
+
+my $ua = LWP::UserAgent->new();
+
+$ua->default_header('Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5');
+$ua->default_header('Accept-Language' => 'en-us,en;q=0.5');
+$ua->default_header('Accept-Charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
+$ua->default_header('Accept-Encoding' => 'gzip,deflate');
+$ua->default_header('Content-Type' => 'text/xml');
+
+my $request = HTTP::Request->new('GET', $url, undef);
+my $response = $ua->request($request);
+
+die "Failed to get response from server: " . $response->status_line
+ unless $response->is_success;
+
+my $freebusy = $response->decoded_content;
+
+my $calendar = Data::ICal->new();
+
+for my $line (split(/\n/, $freebusy)) {
+ next unless $line =~ /^FREEBUSY/;
+
+
+ (my $start, $end) = $line =~ /^FREEBUSY:([0-9TZ]+)\/([0-9TZ]+)/;
+ my $event = Data::ICal::Entry::Event->new();
+ $event->add_properties(
+ summary => 'Busy',
+ dtstart => $start,
+ dtend => $end,
+ );
+
+ $calendar->add_entry($event);
+ $count++;
+}
+
+say $calendar->as_string;
+
+