Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I think this is related to my earlier post about the calendar [perl.org], and stennie is working on something to provide a generic feed from it. You might talk to him about how you'd like to tag conference events, but I think he's going to abuse the location input for that.

    My starter script is also available in that earlier post for anyone who wants to help.
    • I modified it a bit from that starter. After reading some of the docs, I think I can get data ranges and possibly specify the search as part of the request. Here's the script after my mods:


      #!/usr/bin/perl
      use strict;

      use Data::Dumper;
      use Template;
      use DateTime;

      use Net::Google::Calendar;

      my $url = "http://www.google.com/calendar/feeds/ngctmrd1cac35061mrjt3hpgng%40group.calenda r.google.com/public/full";

      my $cal = Net::Google::Calendar->new( url => $url );
      my $dt = DateTime->now();

      my @entries = ();

      # Here, I want events that contain:
      # YAPC, Workshop(s), Conference(s), Hackathon(s)
      # Multiple hits to Google with get_events? Need to prevent dupes.
      # Way to do it with one hit and and 'OR'?

      foreach my $event ( $cal->get_events(
                                                'q' => "YAPC",
                                                'start-min' => $dt,
                                              )
                          )
          {

              my $hash = {};
              my $title = $event->title();
              $hash->{title} = $event->title;

              my $body = $event->content->body;

      # warn $body, "\n\n\n";
              $body =~ s/ / /g;

              # This stuff doesn't seem to work for the 'full' style feed.
              # Need to figure out how to get these details out of the $event
              # object we get back.

              # Default something sensible if we get nothing.

              $hash->{description} = do { $body =~ s/(?:
      \s*)*Event Description:\s+(.*)\s*//; $1 };
              $hash->{status} = do { $body =~ s/(?:
      \s*)*Event Status:\s+(.*)\s*//; $1 };
              $hash->{where} = do { $body =~ s/(?:
      \s*)*Where:\s+(.*)\s*//; $1 };
              $hash->{when} = do { $body =~ s/When:\s+(.*)\s*//; $1 };

              $hash->{when} =~ s/
      Replaces.*//;

              push @entries, $hash;
          }

      print Dumper (\@entries);