blib/lib/CPAN/Digger/CLI.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« bin/cpan-digger ↑ Summary blib/lib/CPAN/Digger.pm »
1 package CPAN::Digger::CLI;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 our $VERSION = '1.04';
6  
7 5 ▶use Getopt::Long qw(GetOptions);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶use CPAN::Digger;
Subroutine BEGIN: called CC=1 SCAR=2.6
10  
11 sub run {
12 my %args = (
13 report => undef,
14 author => undef,
15 vcs => undef,
16 recent => undef,
17 log => 'INFO',
18 help => undef,
19 sleep => 0,
20 db => undef,
21 version => undef,
22 limit => undef,
23 days => undef,
24 html => undef,
25 );
26  
27 GetOptions(
28 \%args,
29 'author=s',
30 'db=s',
31 'recent=i',
32 'limit=i',
33 'sleep=i',
34 'vcs',
35 'log=s',
36 'report',
37 'help',
38 'version',
39 'days:i',
40 'html=s',
41 ) or usage();
42 usage() if $args{help};
43 if ($args{version}) {
44 print "CPAN::Digger VERSION $VERSION\n";
45 exit();
46 }
47 usage() if not ($args{author} xor $args{recent});
48  
49  
50 my $cd = CPAN::Digger->new(%args);
51 $cd->collect();
52 }
53  
54  
55 sub usage {
56 die qq{CPAN::Digger VERSION $VERSION
57  
58 Usage: $0
59 Required exactly one of them:
60 --recent N (Number of the most recent packages to check)
61 --days N
62  
63 --author PAUSEID
64 --limit N
65  
66 --report (Show text report at the end of processing.)
67 --html DIR Create HTML pages in the given directory.
68 --log LEVEL [ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF] (default is INFO)
69  
70 --vcs Fetch information from github, gitlab
71 --sleep SECONDS (Wait time between git clone operations, defaults to 0)
72  
73 --db PATH (path to SQLite database file, if not supplied using in-memory database)
74  
75 --version
76 --help
77  
78 Sample usage for authors:
79 $0 --author SZABGAB --report --vcs --sleep 3
80  
81 Sample usage in general:
82 $0 --recent 30 --report --vcs --sleep 3
83  
84 };
85 }
86  
87  
88 42;
89  
« bin/cpan-digger ↑ Summary blib/lib/CPAN/Digger.pm »