Licence
Creative Commons License

This work by Stephane KATTOOR is licensed under a Creative Commons Attribution 3.0 Unported License.
Feeling like tipping ?
If you find this blog useful, you might consider sending a few bitcoins to support it : 1BTtsC3beGJ6ysd8DhrXjdo6jVw5WD9mvY
RSS
 
RSS Feed
Follow me !
Tech@Sakana on Facebook
Search this site

Newsletter

Get latest posts by email (No spam, only posts):

Enter your email address:

Delivered by FeedBurner

Categories
Monthly archives
November 2005
M T W T F S S
    Dec »
 123456
78910111213
14151617181920
21222324252627
282930  
Day: für den 22. November 2005
Parsing an ICal file with Perl - November 22, 2005 by Stephane Kattoor

I finally almost got it …

Here is a code snippet for parsing and showing pieces of an ICal file :

use strict;
use warnings;

use Data::ICal;
use Data::ICal::DateTime;
use DateTime;

my $cal = Data::ICal->new(filename => 'holidays.ics');

my @events = $cal->events();

foreach my $event (@events) {
        print "summary:", $event->property('summary')->[0]->value, "n";
        print "dtstart:", $event->start, "n";
        print "dtend:", $event->end, "n";
}
print DateTime->now, "n";

What I want to do ? Drive my home automation events with my Mozilla Calendar !! I’ll soon be there, if I gather enough time to do it !

Some pointers :

  • DateTime perl module : a hell of a lot of computations with dates and times
  • Data::ICal perl modules : for all the parsing stuff
  • Data::ICal::DateTime perl module : to get it to work with DateTime
  • Who am I ?
    Ads