Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 13 additions and 5 deletions.
  1. +4 −0 Changes
  2. +9 −5 lib/Net/Google/Analytics.pm
4 Changes
View
@@ -1,5 +1,9 @@
Revision history for Perl module Net::Google::Analytics
+3.01
+ - RT #78789: Fixes for request_paged
+ Thanks to Jon Schutz for the report
+
3.00 2012-02-26
- Major rewrite implementing the version 3 API
14 lib/Net/Google/Analytics.pm
View
@@ -141,6 +141,7 @@ sub retrieve_paged {
$remaining_items : $max_items_per_page;
my $page = $self->_retrieve($req, $start_index, $max_results);
+ return $page if !$page->is_success;
if (!defined($res)) {
$res = $page;
@@ -149,14 +150,17 @@ sub retrieve_paged {
push(@{ $res->rows }, @{ $page->rows });
}
- my $items_per_page = $page->items_per_page;
- last if $items_per_page < $max_results;
+ my $num_items = @{ $page->rows };
+ last if $num_items < $max_results;
- $remaining_items -= $items_per_page if defined($remaining_items);
- $start_index += $items_per_page;
+ $remaining_items -= $num_items if defined($remaining_items);
+ $start_index += $num_items;
}
- $res->items_per_page(scalar(@{ $res->rows }));
+ my $total_items = @{ $res->rows };
+ $res->items_per_page($total_items);
+ # The total result count of the first page isn't always accurate
+ $res->total_results($total_items);
return $res;
}

No commit comments for this range

Something went wrong with that request. Please try again.