Net::GitHub(3pm)
π Net::GitHub β the Perl interface for github.com, bestie π
okay so you want to talk to github.com from Perl? bestie, you have come to the right manual page. this is Net::GitHub, a perl manual page (section 3pm, user contributed, as the top of the page says). sit down, grab a strawberry π, and let's get into it.
β¨ SYNOPSIS β¨
use Net::GitHub;
my $github = Net::GitHub->new( # Net::GitHub::V3
login => 'fayland', pass => 'secret'
);
# If you use two factor authentication you can pass in the OTP. Do
# note that OTPs expire quickly and you will need to generate an oauth
# token to do anything non-trivial.
my $github = Net::GitHub->new(
login => 'fayland',
pass => 'secret',
otp => '123456',
);
# Pass api_url for GitHub Enterprise installations. Do not include a
# trailing slash
my $github = Net::GitHub->new( # Net::GitHub::V3
login => 'fayland',
pass => 'secret',
api_url => 'https://gits.aresweet.com/api/v3'
);
# suggested
# use OAuth to create token with user/pass
my $github = Net::GitHub->new( # Net::GitHub::V3
access_token => $token
);
# L<Net::GitHub::V3::Users>
my $user = $github->user->show('nothingmuch');
$github->user->update( bio => 'Just Another Perl Programmer' );
# L<Net::GitHub::V3::Repos>
my @repos = $github->repos->list;
my $rp = $github->repos->create( {
"name" => "Hello-World",
"description" => "This is your first repo",
"homepage" => "https://github.com"
} );
so yeah. you make a $github object, you call methods on it, magic happens. π
πΈ DESCRIPTION πΈ
<http://github.com> is a popular git host. like, the popular git host. main character energy, honestly. π
this distribution provides easy methods to access GitHub via their APIs. that's it, that's the whole vibe.
check <http://developer.github.com/> for more details of the GitHub APIs. that's where the actual API tea lives.
read Net::GitHub::V3 for API usage.
read Net::GitHub::V4 for GitHub GraphQL API. (yes, GraphQL, we love a modern queen β¨)
if you prefer object oriented way, Pithub is 'There is more than one way to do it'. TMTOWTDI baby, that's the Perl motto, no cap.
π FAQ π
- create
access_tokenfor Non-Web Application
my $gh = Net::GitHub::V3->new( login => 'fayland', pass => 'secret' );
my $oauth = $gh->oauth;
my $o = $oauth->create_authorization( {
scopes => ['user', 'public_repo', 'repo', 'gist'], # just ['public_repo']
note => 'test purpose',
} );
print $o->{token};
after create the token, you can use it without your password publicly written
my $github = Net::GitHub->new(
access_token => $token, # from above
);
like, you literally print out the token once and then never have to hardcode your password anywhere public again. that's the whole point, bestie, protect your secrets π«Ά
π¦ Git π¦
<http://github.com/fayland/perl-net-github/>
go look at the source, it's right there π
β SEE ALSO β
Pithub
(they do the object-oriented thing, iykyk)
π AUTHOR π
Fayland Lam, "<fayland at gmail.com>"
Everyone who is listed in Changes.
(the whole squad, fr fr π«Ά)
π COPYRIGHT & LICENSE π
Copyright 2009-2012 Fayland Lam all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
periodt. π
okay bestie that's the whole page, you're officially a Net::GitHub girlie now π this was Net::GitHub(3pm) from perl v5.36.0, dated 2022-10-08 β go forth and slay those API calls β¨ππ¦
π¦ where this page comes from
- ubuntu noble: libnet-github-perl 1.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-github-perl 1.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-github-perl 1.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms