NAME

WWW::Github::Files - Read files and directories from Github

SYNOPSIS

my $gitfiles = WWW::Github::Files->new(
    author => 'semuel',
    resp => 'site-lang-collab',
    branch => 'master',
);

my @files = $gitfiles->open('/')->readdir();

DESCRIPTION

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

ALTERNATIVES

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.

CONSTRUCTOR OPTIONS

author - resp author
resp - resp name
branch - The branch to read from

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

commit - a specific commit to read from

The object will retrive files and directories as they were after this commit

token

Optional Net::Oauth2 Access Token, for using in API calls. If not specified, will make anonymous calls using LWP

METHODS

open(path)

receive path (which have to start with '/') and return file or dir object for that location

get_file(path)

shortcut to $gitfiles->open(path)->read()

get_dir(path)

shortcut to $gitfiles->open(path)->readdir()

FILE OBJECT METHODS

name

The name of the file

path

full path (+name) of the file

is_file

is_dir

read

returns the content of the file

DIRECTORY OBJECT METHODS

name

The name of the directory

path

full path (+name) of the directory

is_file

is_dir

readdir

returns a list of file/dir objects that this directory contains

AUTHOR

Fomberg Shmuel, <shmuelfomberg@gmail.com>

COPYRIGHT AND LICENSE

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:

Around line 194:

Unknown directive: =HEAD1