| 1 | package CPAN::Mini::Inject::REST::Client; | ||
| 2 | |||
| 3 | 1 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use App::Cmd::Setup -app; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | use Config::General qw/ParseConfig/; | ||
| 8 | use File::HomeDir; | ||
| 9 | use File::Spec::Functions qw/catfile/; | ||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | CPAN::Mini::Inject::REST::Client - Command-line client for CPAN::Mini::Inject::REST | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | our $VERSION = '0.02'; | ||
| 18 | |||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | mcpani-client <command> <options> <files> | ||
| 23 | |||
| 24 | mcpani-client add --host mycpan.local MyModule-0.01.tar.gz | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | Provides a command-line client, F<mcpani-client>, to interact with a | ||
| 29 | L<CPAN::Mini::Inject::REST> API server. | ||
| 30 | |||
| 31 | This allows distributions to be remotely uploaded to your CPAN mirror, | ||
| 32 | and for the contents of your mirror to be queried and downloaded. | ||
| 33 | |||
| 34 | See L<mcpani-client> for full documentation on the available commands. | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | sub config { | ||
| 39 | state $config = {ParseConfig(config_file())}; | ||
| 40 | return $config; | ||
| 41 | } | ||
| 42 | |||
| 43 | sub config_file { | ||
| 44 | my @files = ( | ||
| 45 | $ENV{MCPANI_CLIENT_CONFIG}, | ||
| 46 | catfile(File::HomeDir->my_home, '.mcpani-client'), | ||
| 47 | '/usr/local/etc/mcpani-client', | ||
| 48 | '/etc/mcpani-client', | ||
| 49 | ); | ||
| 50 | |||
| 51 | foreach my $file (grep {defined $_} @files) { | ||
| 52 | return $file if -r $file; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | =head1 AUTHOR | ||
| 57 | |||
| 58 | Jon Allen (JJ), C<< <jj at jonalen.info> >> | ||
| 59 | |||
| 60 | =head1 LICENSE AND COPYRIGHT | ||
| 61 | |||
| 62 | Copyright 2011 Jon Allen (JJ). | ||
| 63 | |||
| 64 | This program is free software; you can redistribute it and/or modify it | ||
| 65 | under the terms of either: the GNU General Public License as published | ||
| 66 | by the Free Software Foundation; or the Artistic License. | ||
| 67 | |||
| 68 | See http://dev.perl.org/licenses/ for more information. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 1; # End of CPAN::Mini::Inject::REST::Client | ||