Skip Menu |

This queue is for tickets about the Net-Google-Calendar CPAN distribution.

Report information
The Basics
Id: 31706
Status: resolved
Priority: 0/
Queue: Net-Google-Calendar

People
Owner: Nobody in particular
Requestors: jamesw [...] bsdhosting.co.za
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::Google::Calendar $cal->get_events(entryID => $entryid) doesn't match existing entries
Date: Wed, 19 Dec 2007 07:26:28 -0800
To: Bugs in Net-Google-Calendar via RT <bug-Net-Google-Calendar [...] rt.cpan.org>
From: James Wright <jamesw [...] bsdhosting.co.za>
in Calendar.pm the _get function attempts to coerce http://www.google.com/calendar/feeds/$calendarid/private/full/$entryid into an XML::Atom::Feed object when it doesn't contain entries. By adding a function _get_entry and coercing the entry url into a more correct XML::Atom::Entry object and blessing that into a Net::Google::Calendar::Entry object, $cal->get_events(entryID => $entryid) works. Attached patch applies those changes to Net/Google/Calendar.pm
--- lib/Net/Google/Calendar.pm.orig Sun Dec 16 04:52:27 2007 +++ lib/Net/Google/Calendar.pm Wed Dec 19 07:03:57 2007 @@ -436,6 +436,7 @@ my $url = URI->new($self->{url}); + # special handling for single entryID lookup if (exists $opts{entryID}) { if (scalar(keys %opts)>1) { $@ = "You can't specify entryID and anything else"; @@ -443,6 +444,7 @@ } my $path = $url->path; $url->path("$path/".$opts{entryID}); + return $self->_get_entry("$url", "Net::Google::Calendar::Entry"); } if (exists $opts{category} && 'ARRAY' eq ref($opts{category})) { @@ -539,6 +541,25 @@ my $feed = XML::Atom::Feed->new(\$atom); return map { bless $_, $class; $_->_initialize(); $_ } $feed->entries; +} + +sub _get_entry { + my ($self, $url, $class) = @_; + my %params = ($self->{_auth}->auth_params); + my $r = $self->{_ua}->get("$url", %params); + + if (!$r->is_success) { + if ($r->code == 404) { + $@ = "EntryID not found"; + } else { + $@ = $r->status_line; + } + return; + } + my $atom = $r->content; + + my $entry = XML::Atom::Entry->new(\$atom); + return bless $entry, $class; } =head2 set_calendar <Net::Google::Calendar::Calendar>
Fixed in 0.92 - cheers!