blib/lib/CPAN/Digger/CLI.pm

filter: Statementstmt 87.5% 21 / 24 Branchbran 50.0% 4 / 8 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 69.5% 32 / 46 SCAR 18.8
CC
6
Cov
75%
run
8.0
usage
2.0
BEGIN
1.0
CRAP 6.6
« blib/lib/CPAN/Digger.pm ↑ Summary blib/lib/CPAN/Digger/DB.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 5 our $VERSION = '1.03';
6  
7 5 ▶use Getopt::Long qw(GetOptions);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use CPAN::Digger;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub run {
12 5 ▶ my %args = (
Subroutine run: called CC=6 SCAR=20.8
Pod undocumented
13 report => undef,
14 author => undef,
15 github => undef,
16 recent => undef,
17 log => 'INFO',
18 help => undef,
19 sleep => 0,
20 db => undef,
21 version => undef,
22 limit => undef,
23 );
24  
25 5 ▶ GetOptions(
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions(\%args, "author=s", "db=s", "recent=i", "limit=i", "sleep=i", "github", "log=s", "report", "help", "version") or usage() 0 5 5
26 \%args,
27 'author=s',
28 'db=s',
29 'recent=i',
30 'limit=i',
31 'sleep=i',
32 'github',
33 'log=s',
34 'report',
35 'help',
36 'version',
37 ) or usage();
38 5 ▶ usage() if $args{help};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"help"} 0 5 5
39 5 ▶ if ($args{version}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"version"}) 0 5 5
40 0 print "CPAN::Digger VERSION $VERSION\n";
41 0 exit();
42 }
43 5 ▶ usage() if not ($args{author} xor $args{recent});
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"author"} xor $args{"recent"} 0 5 5
Condition50%2/4
$args{"author"} xor $args{"recent"}
l&&rl&&!r!l&&r!l&&!r
0320
MC/DC0%0/2
$args{"author"} xor $args{"recent"}
$args{"author"} $args{"recent"}
Truth table50%2/4
A xor B
A= $args{"author"}B= $args{"recent"}
ABresult
110
101
011
000
44  
45  
46 5 my $cd = CPAN::Digger->new(%args);
47 5 $cd->collect();
48 }
49  
50  
51 sub usage {
52 0 ▶ die qq{CPAN::Digger VERSION $VERSION
Subroutine usage: not called CC=1 SCAR=6.9
Pod undocumented
53  
54 Usage: $0
55 Required exactly one of them:
56 --recent N (Number of the most recent packages to check)
57 --author PAUSEID
58  
59 --report (Show text report at the end of processing.)
60 --log LEVEL [ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF] (default is INFO)
61  
62 --github Fetch information from github
63 --sleep SECONDS (Wait time between git clone operations, defaults to 0)
64  
65 --db PATH (path to SQLite database file, if not supplied using in-memory database)
66  
67 --version
68 --help
69  
70 Sample usage for authors:
71 $0 --author SZABGAB --report --github --sleep 3
72  
73 Sample usage in general:
74 $0 --recent 30 --report --github --sleep 3
75  
76 };
77 }
78  
79  
80 5 42;
81  
« blib/lib/CPAN/Digger.pm ↑ Summary blib/lib/CPAN/Digger/DB.pm »