Pithub - Github v3 API
version 0.01003
use Pithub; use Data::Dumper; $p = Pithub->new; $result = $p->repos->get( user => 'plu', repo => 'Pithub' ); # $result->content is either an arrayref or an hashref # depending on the API call that has been made printf "%s\n", $result->content->{html_url}; # prints https://github.com/plu/Pithub printf "%s\n", $result->content->{clone_url}; # prints https://github.com/plu/Pithub.git # if the result is an arrayref, you can use the result iterator $result = $p->repos->list( user => 'plu' ); while ( my $row = $result->next ) { printf "%s\n", $row->{name}; }
Pithub as well as the Github v3 API are still under development. So there might be things broken on both sides. Besides that it's possible that the API will change. This applies to Pithub itself as well as the Github v3 API.
There are different ways of using Pithub library. You can either use the main module Pithub to get access to all other modules like Pithub::Repos for example, or you can use Pithub::Repos directly. In the synopsis above, all the calls are equivalent. Here's an overview over all modules and how to get access to them:
Pithub
Pithub::Gists
See also: http://developer.github.com/v3/gists/
$gists = Pithub->new->gists; $gists = Pithub::Gists->new;
Pithub::Gists::Comments
See also: http://developer.github.com/v3/gists/comments/
$comments = Pithub->new->gists->comments; $comments = Pithub::Gists->new->comments; $comments = Pithub::Gists::Comments->new;
Pithub::GitData
See also: http://developer.github.com/v3/git/
$git_data = Pithub->new->git_data; $git_data = Pithub::GitData->new;
Pithub::GitData::Blobs
See also: http://developer.github.com/v3/git/blobs/
$blobs = Pithub->new->git_data->blobs; $blobs = Pithub::GitData->new->blobs; $blobs = Pithub::GitData::Blobs->new;
Pithub::GitData::Commits
See also: http://developer.github.com/v3/git/commits/
$commits = Pithub->new->git_data->commits; $commits = Pithub::GitData->new->commits; $commits = Pithub::GitData::Commits->new;
Pithub::GitData::References
See also: http://developer.github.com/v3/git/refs/
$references = Pithub->new->git_data->references; $references = Pithub::GitData->new->references; $references = Pithub::GitData::References->new;
Pithub::GitData::Tags
See also: http://developer.github.com/v3/git/tags/
$tags = Pithub->new->git_data->tags; $tags = Pithub::GitData->new->tags; $tags = Pithub::GitData::Tags->new;
Pithub::GitData::Trees
See also: http://developer.github.com/v3/git/trees/
$trees = Pithub->new->git_data->trees; $trees = Pithub::GitData->new->trees; $trees = Pithub::GitData::Trees->new;
Pithub::Issues
See also: http://developer.github.com/v3/issues/
$issues = Pithub->new->issues; $issues = Pithub::Issues->new;
Pithub::Issues::Comments
See also: http://developer.github.com/v3/issues/comments/
$comments = Pithub->new->issues->comments; $comments = Pithub::Issues->new->comments; $comments = Pithub::Issues::Comments->new;
Pithub::Issues::Events
See also: http://developer.github.com/v3/issues/events/
$events = Pithub->new->issues->events; $events = Pithub::Issues->new->events; $events = Pithub::Issues::Events->new;
Pithub::Issues::Labels
See also: http://developer.github.com/v3/issues/labels/
$labels = Pithub->new->issues->labels; $labels = Pithub::Issues->new->labels; $labels = Pithub::Issues::Labels->new;
Pithub::Issues::Milestones
See also: http://developer.github.com/v3/issues/milestones/
$milestones = Pithub->new->issues->milestones; $milestones = Pithub::Issues->new->milestones; $milestones = Pithub::Issues::Milestones->new;
Pithub::Orgs
See also: http://developer.github.com/v3/orgs/
$orgs = Pithub->new->orgs; $orgs = Pithub::Orgs->new;
Pithub::Orgs::Members
See also: http://developer.github.com/v3/orgs/members/
$members = Pithub->new->orgs->members; $members = Pithub::Orgs->new->members; $members = Pithub::Orgs::Members->new;
Pithub::Orgs::Teams
See also: http://developer.github.com/v3/orgs/teams/
$teams = Pithub->new->orgs->teams; $teams = Pithub::Orgs->new->teams; $teams = Pithub::Orgs::Teams->new;
Pithub::PullRequests
See also: http://developer.github.com/v3/pulls/
$pull_requests = Pithub->new->pull_requests; $pull_requests = Pithub::PullRequests->new;
Pithub::PullRequests::Comments
See also: http://developer.github.com/v3/pulls/comments/
$comments = Pithub->new->pull_requests->comments; $comments = Pithub::PullRequests->new->comments; $comments = Pithub::PullRequests::Comments->new;
Pithub::Repos
See also: http://developer.github.com/v3/repos/
$repos = Pithub->new->repos; $repos = Pithub::Repos->new;
Pithub::Repos::Collaborators
See also: http://developer.github.com/v3/repos/collaborators/
$collaborators = Pithub->new->repos->collaborators; $collaborators = Pithub::Repos->new->collaborators; $collaborators = Pithub::Repos::Collaborators->new;
Pithub::Repos::Commits
See also: http://developer.github.com/v3/repos/commits/
$commits = Pithub->new->repos->commits; $commits = Pithub::Repos->new->commits; $commits = Pithub::Repos::Commits->new;
Pithub::Repos::Downloads
See also: http://developer.github.com/v3/repos/downloads/
$downloads = Pithub->new->repos->downloads; $downloads = Pithub::Repos->new->downloads; $downloads = Pithub::Repos::Downloads->new;
Pithub::Repos::Forks
See also: http://developer.github.com/v3/repos/forks/
$forks = Pithub->new->repos->forks; $forks = Pithub::Repos->new->forks; $forks = Pithub::Repos::Forks->new;
Pithub::Repos::Keys
See also: http://developer.github.com/v3/repos/keys/
$keys = Pithub->new->repos->keys; $keys = Pithub::Repos->new->keys; $keys = Pithub::Repos::Keys->new;
Pithub::Repos::Watching
See also: http://developer.github.com/v3/repos/watching/
$watching = Pithub->new->repos->watching; $watching = Pithub::Repos->new->watching; $watching = Pithub::Repos::Watching->new;
Pithub::Users
See also: http://developer.github.com/v3/users/
$users = Pithub->new->users; $users = Pithub::Users->new;
Pithub::Users::Emails
See also: http://developer.github.com/v3/users/emails/
$emails = Pithub->new->users->emails; $emails = Pithub::Users->new->emails; $emails = Pithub::Users::Emails->new;
Pithub::Users::Followers
See also: http://developer.github.com/v3/users/followers/
$followers = Pithub->new->users->followers; $followers = Pithub::Users->new->followers; $followers = Pithub::Users::Followers->new;
Pithub::Users::Keys
See also: http://developer.github.com/v3/users/keys/
$keys = Pithub->new->users->keys; $keys = Pithub::Users->new->keys; $keys = Pithub::Users::Keys->new;
Besides that there are other modules involved. Every method call which maps directly to a Github API call returns a Pithub::Result object. This contains everything interesting about the response (Pithub::Response) returned from the API call as well as the request (Pithub::Request). Even the Pithub::Base module might be interesting because this one provides the "request" in Pithub::Base method, which is used by all other modules. In case Github adds a new API call which is not supported yet by Pithub the "request" in Pithub::Base method can be used directly.
Johannes Plunien <plu@cpan.org>
This software is copyright (c) 2011 by Johannes Plunien.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
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.