WWW::Github::Files - Read files and directories from Github
my $gitfiles = WWW::Github::Files->new( author => 'semuel', resp => 'site-lang-collab', branch => 'master', ); my @files = $gitfiles->open('/')->readdir();
Using Github API to browse a git resp easily and download files
This modules is a thin warper around the API, just to make life easier
The easiest way to get a file off Github is to use the raw url:
https://raw.github.com/semuel/perlmodule-WWW-Github-Files/master/MANIFEST
This will return the content of this module's MANIFEST file. Easy, but the file have to be public and you need to know beforehand where exactly it is. (this method does not fetch directory content)
Also, if you download two files under 'master', there is a chance that a commit happened in the middle and you get two files from two different versions of the respo. Of course you can fetch the current commit and use it instead of master, but then it is less easy
This module let you use Access Token for permission, and scan directories
Need to write code that read files from Github and local repositories? Check out WWW::Github::Files::Mock that uses the same interface for local directory.
Mutual exlusive with 'commit'.
On first access the object will "lock" on the latest commit in this branch, and from this point will serve files only from this commit
The object will retrive files and directories as they were after this commit
Optional Net::Oauth2 Access Token, for using in API calls. If not specified, will make anonymous calls using LWP
receive path (which have to start with '/') and return file or dir object for that location
shortcut to $gitfiles->open(path)->read()
shortcut to $gitfiles->open(path)->readdir()
The name of the file
full path (+name) of the file
returns the content of the file
The name of the directory
full path (+name) of the directory
returns a list of file/dir objects that this directory contains
Fomberg Shmuel, <shmuelfomberg@gmail.com>
Copyright 2013 by Shmuel Fomberg.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Unknown directive: =HEAD1
To install WWW::Github::Files, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Github::Files
CPAN shell
perl -MCPAN -e shell install WWW::Github::Files
For more information on module installation, please visit the detailed CPAN module installation guide.