1Net::GitHub(3) User Contributed Perl Documentation Net::GitHub(3)
2
3
4
6 Net::GitHub - Perl Interface for github.com
7
9 use Net::GitHub;
10
11 my $github = Net::GitHub->new( # Net::GitHub::V3
12 login => 'fayland', pass => 'secret'
13 );
14
15 # If you use two factor authentication you can pass in the OTP. Do
16 # note that OTPs expire quickly and you will need to generate an oauth
17 # token to do anything non-trivial.
18 my $github = Net::GitHub->new(
19 login => 'fayland',
20 pass => 'secret',
21 otp => '123456',
22 );
23
24 # Pass api_url for GitHub Enterprise installations. Do not include a
25 # trailing slash
26 my $github = Net::GitHub->new( # Net::GitHub::V3
27 login => 'fayland',
28 pass => 'secret',
29 api_url => 'https://gits.aresweet.com/api/v3'
30 );
31
32 # suggested
33 # use OAuth to create token with user/pass
34 my $github = Net::GitHub->new( # Net::GitHub::V3
35 access_token => $token
36 );
37
38 # L<Net::GitHub::V3::Users>
39 my $user = $github->user->show('nothingmuch');
40 $github->user->update( bio => 'Just Another Perl Programmer' );
41
42 # L<Net::GitHub::V3::Repos>
43 my @repos = $github->repos->list;
44 my $rp = $github->repos->create( {
45 "name" => "Hello-World",
46 "description" => "This is your first repo",
47 "homepage" => "https://github.com"
48 } );
49
51 <http://github.com> is a popular git host.
52
53 This distribution provides easy methods to access GitHub via their
54 APIs.
55
56 Check <http://developer.github.com/> for more details of the GitHub
57 APIs.
58
59 Read Net::GitHub::V3 for API usage.
60
61 Read Net::GitHub::V4 for GitHub GraphQL API.
62
63 If you prefer object oriented way, Pithub is 'There is more than one
64 way to do it'.
65
66 FAQ
67 • create access_token for Non-Web Application
68
69 my $gh = Net::GitHub::V3->new( login => 'fayland', pass => 'secret' );
70 my $oauth = $gh->oauth;
71 my $o = $oauth->create_authorization( {
72 scopes => ['user', 'public_repo', 'repo', 'gist'], # just ['public_repo']
73 note => 'test purpose',
74 } );
75 print $o->{token};
76
77 after create the token, you can use it without your password
78 publicly written
79
80 my $github = Net::GitHub->new(
81 access_token => $token, # from above
82 );
83
85 <http://github.com/fayland/perl-net-github/>
86
88 Pithub
89
91 Fayland Lam, "<fayland at gmail.com>"
92
93 Everyone who is listed in Changes.
94
96 Copyright 2009-2012 Fayland Lam all rights reserved.
97
98 This program is free software; you can redistribute it and/or modify it
99 under the same terms as Perl itself.
100
101
102
103perl v5.34.1 2022-04-22 Net::GitHub(3)