Skip to content

Commit

Permalink
Automatically get all pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nebulous committed Feb 14, 2013
1 parent 1c52890 commit 1c3ba0a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Net/GitHub/V3/Query.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ has 'u' => (is => 'rw', isa => 'Str');
has 'repo' => (is => 'rw', isa => 'Str');

has 'is_main_module' => (is => 'ro', isa => 'Bool', default => 0);

sub set_default_user_repo {
my ($self, $user, $repo) = @_;

$self->u($user);
$self->repo($repo);

Expand Down Expand Up @@ -134,7 +134,6 @@ sub query {
$req->content($json);
}
$req->header( 'Content-Length' => length $req->content );

my $res = $ua->request($req);

# Slow down if we're approaching the rate limit
Expand Down Expand Up @@ -171,6 +170,8 @@ sub query {
$self->_extract_link_url(\@rel_strs);
}

push(@$data, $self->next_page) if $self->has_next_page;

## be smarter
if (wantarray) {
return @$data if ref $data eq 'ARRAY';
Expand Down Expand Up @@ -316,4 +317,4 @@ Calls C<query> with C<next_url>. See L<Net::GitHub::V3>
=head1 AUTHOR & COPYRIGHT & LICENSE
Refer L<Net::GitHub>
Refer L<Net::GitHub>

0 comments on commit 1c3ba0a

Please sign in to comment.