NAME

cpan-mirror-tiny - CPAN::Mirror::Tiny command line interface

SYNOPSIS

$ cpan-mirror-tiny inject    [option] url1 url2 ...
$ cpan-mirror-tiny gen-index [option]
$ cpan-mirror-tiny cat-index [option]
$ cpan-mirror-tiny list      [option]
$ cpan-mirror-tiny server    [option]

OPTIONS

-h, --help      show help
-v, --version   show version
-a, --author    specify author, default: VENDOR
-b, --base      base directory,
                default: $ENV{PERL_CPAN_MIRROR_TINY_BASE} or ./darkpan

EXAMPLES

$ cpan-mirror-tiny inject cpan:Plack
$ cpan-mirror-tiny inject cpan:Plack@1.0039
$ cpan-mirror-tiny inject --author YOU http://exmpale.com/Module-0.01.tar.gz
$ cpan-mirror-tiny inject --author YOU git://github.com/you/Module.git@develop
$ cpan-mirror-tiny inject --author YOU /path/to/local/Module-0.01.tar.gz
$ cpan-mirror-tiny inject --author YOU /path/to/local/dir

DESCRIPTION

This is a command line interface for CPAN::Mirror::Tiny. You can easily create your darkpan with this script.

TYPICAL USAGE

Let's create your darkpan in ./darkpan directory.

First inject distributions into your darkpan with inject command:

# from github, with optional ref (revision/tag/branch)
$ cpan-mirror-tiny inject --author SKAJI git://github.com/skaji/cpm.git
$ cpan-mirror-tiny inject --author SKAJI https://github.com/skaji/cpm@0.118

# from cpan, with optional version (author is automatically guessed)
$ cpan-mirror-tiny inject cpan:Plack
$ cpan-mirror-tiny inject cpan:Dist::Zilla@5.046

# from http server
$ cpan-mirror-tiny inject --author YOU http://example.com/path/to/Your-Module-0.01.tar.gz

# from local file/directory
$ cpan-mirror-tiny inject --author YOU /path/to/local/Module-0.01.tar.gz
$ cpan-mirror-tiny inject --author YOU /path/to/local/dir

Second, create the index file 02packages.details.txt.gz by gen-index command:

$ cpan-mirror-tiny gen-index

Check your darkpan with list command:

$ cpan-mirror-tiny list

Now your darkpan has your own distributions. Let's install distributions with CPAN client cpm:

$ cpm install --resover 02packages,file://$PWD/darkpan --resover metadb Your::Module

HTTP SERVER

If you want to use your darkpan in other hosts, run a http server first:

[host1]$ cpan-mirror-tiny server
HTTP::Server::PSGI: Accepting connections at http://0:5000/

Then

[host2]$ cpm install --resolver 02packages,http://host1:5000 --resolver metadb Your::Module

Moreover you can inject/upload your modules against http://host1:5000/upload:

inject git repositories
[host2]$ curl --data-urlencode 'module=git://github.com/skaji/Carl.git' \
              --data-urlencode 'author=SKAJI' http://host1:5000/upload
upload tarballs with cpan-upload
[host2]$ export CPAN_UPLOADER_UPLOAD_URI=http://host1:5000/upload
[host2]$ cpan-upload --user SKAJI --password dummy /path/to/local/Module-0.01.tar.gz

Note that cpan-mirror-tiny server accepts the same options as plackup such as --port, --server:

[host1]$ cpan-mirror-tiny server --server Starman --port 8888