Pithub::Result
version 0.01000
The decoded JSON response. May be an arrayref or hashref, depending on the API call.
The extracted value from the Link header for the first page. This can return undef.
Link
The extracted value from the Link header for the last page. This can return undef.
The extracted value from the Link header for the next page. This can return undef.
The extracted value from the Link header for the previous page. This can return undef.
The Pithub::Response object. There are following delegate methods installed for convenience:
code: response->code
raw_content: response->content
request: response->request
success: response->success
Get the Pithub::Result of the first page. Returns undef if there is no first page (if you're on the first page already or if there is no pages at all).
Get the Pithub::Result of the last page. Returns undef if there is no last page (if you're on the last page already or if there is only one page or no pages at all).
Get the Pithub::Result of the next page. Returns undef if there is no next page (there's only one page at all).
Examples:
List all followers in order, from the first one on the first page to the last one on the last page.
$followers = Pithub->new->users->followers; $result = $followers->list( user => 'rjbs' ); do { if ( $result->success ) { foreach my $row ( @{ $result->content } ) { printf "%s\n", $row->{login}; } } } while $result = $result->next_page;
The nature of the implementation requires you here to do a do { ... } while ... loop.
do { ... } while ...
Get the Pithub::Result of the previous page. Returns undef if there is no previous page (you're on the first page).
List all followers in reverse order, from the last one on the last page to the first one on the first page.
$followers = Pithub->new->users->followers; $result = $followers->list( user => 'rjbs' )->last_page; # this makes two requests! do { if ( $result->success ) { foreach my $row ( reverse @{ $result->content } ) { printf "%s\n", $row->{login}; } } } while $result = $result->prev_page;
Returns the value of the X-Ratelimit-Limit http header.
X-Ratelimit-Limit
Returns the value of the X-Ratelimit-Remaining http header.
X-Ratelimit-Remaining
To install Pithub, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pithub
CPAN shell
perl -MCPAN -e shell install Pithub
For more information on module installation, please visit the detailed CPAN module installation guide.