Subject: | Infinite Looping for function "find_hosted_zone" with accounts having more than 100 hosted zones |
Error Message: Use of uninitialized value $marker in substitution (s///)
at
/home/anand/trunk/cpan/cpan-5.010/lib/perl5/WebService/Amazon/Route53.pm
line 430.
If there are more than 100 hosted zones the last $zone is not able to be
accessed for the getting the new $marker. this leads to an infinite loop
with the above error message being repeated. this is because the $zone
is reference whose scope ceases to exist outside the foreach loop.
I am suggesting the following fix through which I am able to find zones
more than 100 on the Route53. The fix starts at line 402 for the sub
"find_hosted_zone". Please verify and correct it.
File name: Route53.pm Module: WebService::Amazon::Route53
+ Add the line
- Remove the line
@@ -402,32 +402,37 @@ sub find_hosted_zone {
my $found_zone = 0;
my $marker;
-
+ my $last_zone;
+ my $zone;
ZONES: while (1) {
my $zones = $self->list_hosted_zones(max_items => 100,
marker => $marker);
-
+
if (!defined $zones) {
# We can assume $self->{error} is already set
return undef;
}
- my $zone;
foreach $zone (@$zones) {
if ($zone->{name} eq $args{'name'}) {
$found_zone = $zone;
last ZONES;
}
+ %{$last_zone} = %{$zone};
}
if (@$zones < 100) {
# Less than 100 zones have been returned -- no more zones
to get
last ZONES;
}
else {
# Get the marker from the last returned zone
- ($marker = $zone->{'id'}) =~ s!^/hostedzone/!!;
+ ($marker = $last_zone->{'id'}) =~ s!^/hostedzone/!!;
}