in reply to Anyone know how to use the Net::Google::Calendar API?

the docos are rather vague aren't they...

I had a look through the test suite and the example file google-calendar, and noticed that set_calendar($c) seems to be used prior to calling get_events()... Its entirely possible that this example file is very old and that requirement is now obselete. But FWIW, that was the only difference that jumped out at me while comparing your code with the example...

I haven't got the module installed so can't test it - but hopefully its a step in the right direction...
good hunting...

Update: Added in snippet to which i was referring to...
my @calendars = $cal->get_calendars; my ($c) = grep { $_->title =~ m!default!i } $cal->get_calendars; #die "Couldn't get cal\n" unless defined $c; $c = $calendars[0]; $cal->set_calendar($c); if (!@ARGV) { print "Getting events\n"; for ($cal->get_events()) { #print Dumper $_->as_xml; #next; print $_->title."\n"; print $_->id."\n"; my ($start, $finish) = $_->when(); print "${start}-${finish}\n"; #print $_->content->body; print "\n*****\n\n"; } exit; }
Update2: Just noticed that Simon Wistow still considers this module to be Alpha... could well be that get_events simply doesn't work properly yet...

Replies are listed 'Best First'.
Re^2: Anyone know how to use the Net::Google::Calendar API?
by leocharre (Priest) on Dec 09, 2009 at 15:13 UTC
    Aha! Guess what! That was it... Have to call set_calendar()..
    # pseudocode: my $parent = Net::Google::Calendar->new; $parent->login( $uname, $upass); my @cals = $parent->get_calendars; for my $cal_selected (@cals) { printf "CALENDAR: %s\n", $cal_selected->title; $parent->set_calendar( $cal ); my @e = $parent->get_events; for (@e){ printf "event title: %s, content: %s\n", $_->title, $_->content->body; } }

    Yes Wistow notes 'Alpha'- that said, some reviewees state the thing 'does what they need' - so- missing this functinality- it seems odd it would be of use at all- that's why I thought maybe I was off..

    I'm kinda torn about using oo this way, it's really weird.. it seems we should instance a calendar object, and *it* should have a get_events() method, no?

    This other way is kind of interesting too.. passing around objects like little toys..

    Thank you!!!!!!

      Hi

      Does anyone know how to create and save a new Calendar using this module? I know it's doable
      http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#CreatingCalendars
      I have no clue how to achieve it with the API :(.

      thanks for any suggestions

        in this how to update or edit a particular event