File Coverage

blib/lib/CPAN/Mini/Inject/REST/Client.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package CPAN::Mini::Inject::REST::Client;
2              
3 1     1   19800 use 5.010;
  1         5  
  1         49  
4 1     1   7 use strict;
  1         2  
  1         83  
5 1     1   5 use warnings;
  1         6  
  1         50  
6 1     1   939 use App::Cmd::Setup -app;
  1         1315190  
  1         8  
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
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, to interact with a
29             L 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 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<< >>
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