Subject: | 302 Moved Temporarily at /usr/local/share/perl/5.8.8/Net/Google/Calendar.pm line 619. |
Date: | Wed, 27 Jul 2011 09:44:07 +0200 |
To: | bug-Net-Google-Calendar [...] rt.cpan.org |
From: | Peter Retep <peter_retep [...] gmx.de> |
Hi Simon,
I am not sure if there were some changes at Google side or if there is an issue with Net::Google::Calendar.
I used Net::Google::Calendar for months without any problems, thanks for this amazing interface!
Problems started at the start of June 2011:
If I use private calendar URL with email and password login, I get following message on $cal->get_events after successfully receiving and deleting some events.
302 Moved Temporarily at /usr/local/share/perl/5.8.8/Net/Google/Calendar.pm line 619.
This is example code to see what type of requests is used:
$XML::Atom::ForceUnicode = 1;
$XML::Atom::DefaultVersion = "1.0";
$cal = Net::Google::Calendar->new( url => 'http://www.google.com/calendar/feeds/xxx%40group.calendar.google.com/private-xxx/full' );
$cal->login($email, $password) ;
for my $range (@ranges){
my @events=$cal->get_events(get_range_parameters($range));
for my $event(@events){
$cal->delete_entry($event);
};
}
sub get_range_parameter{
my $start=$range->{start};
my $end =$range->{end};
my $parameters={};
$parameters->{"start-min"} = $start->datetime;
$parameters->{"recurrence-expansion-start"}= $start->datetime;
$parameters->{"start-max"} = $end->datetime;
$parameters->{"recurrence-expansion-end"}= $end->datetime;
return $parameters;
}
This (slightly changed) workaround I found at http://cpanforum.com/posts/13346
before line 619 in Net::Google::Calendar
if ($r->code == 302) {
my $c=0;
while(($c<10)&&($r->code == 302)){
print STDERR "warn: error 302" if ($c>0);
my $location = $r->header('location');
my %params = ($self->{_auth}->auth_params('GET', $location), %opts);
$r = $self->{_ua}->get($location, %params);
$c++;
}
}
but I am not sure if it fixes the root cause, sometimes I get 501's using it.
my environment:
Net::Google::Calendar 1.0
perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
Linux hostname 2.6.18-028stab070.14 #1 SMP Thu Nov 18 16:04:02 MSK 2010 x86_64 GNU/Linux
Best Regards, Peter