script/ircindexer-examplecf

filter: Statementstmt 85.1% 23 / 27 Branchbran 33.3% 2 / 6 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 70.2% 33 / 47 CC 1 SCAR 0.0
CC
1
Cov
71%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« script/ircindexer-server-json ↑ Summary lib/IRC/Indexer.pm »
1 #!/usr/local/bin/perl
2  
3 3 ▶use 5.10.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use IRC::Indexer::Conf;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 my($cftype, $outpath, $show);
10 3 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 GetOptions(
12 1 ▶ help => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
13 1 print(
14 "ircindexer-examplecf\n",
15 " Write example configuration files.\n\n",
16
17 " -s, --show\n",
18 " Display, rather than write, the example config.\n\n",
19
20 " -o, --output=PATH\n",
21 " Path to the destination to write.\n\n",
22
23 " -t, --type=TYPE\n",
24 " Type of config to output.\n",
25 " One of: httpd, spec\n\n",
26
27 );
28 1 exit 0
29 },
30  
31 3 'type|config=s' => \$cftype,
32
33 'output|file=s' => \$outpath,
34
35 'show!' => \$show,
36 );
37  
38 2 ▶$cftype = lc($cftype||'');
Condition50%1/2
$cftype || ''
l!l
20
MC/DC0%0/1
$cftype || ''
$cftype
Truth table50%1/2
A
A= $cftype
Aresult
11
00
39  
40 2 ▶die "Invalid --type\nShould be one of: httpd, spec\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $cftype and $cftype ~~ ["httpd", "spec"] 0 2 2
Condition33%1/3
$cftype and $cftype ~~ ["httpd", "spec"]
!ll&&!rl&&r
002
MC/DC0%0/2
$cftype and $cftype ~~ ["httpd", "spec"]
$cftype $cftype ~~ ["httpd", "spec"]
Truth table33%1/3
A and B
A= $cftypeB= $cftype ~~ ["httpd", "spec"]
ABresult
0X0
100
111
41 unless $cftype and $cftype ~~ [qw/httpd spec/];
42  
43 2 ▶if ($show) {
Branch: 1 branch
BranchTrueFalseTotal
if ($show) 2 0 2
44 2 print IRC::Indexer::Conf->get_example_cf($cftype);
45 2 exit 0
46 }
47  
48 0 ▶die "No --output file specified\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $outpath 0 0 0
49 unless $outpath;
50  
51  
52 0 print "Writing: $outpath\n";
53 0 IRC::Indexer::Conf->write_example_cf($cftype, $outpath);
54 0 exit 0
« script/ircindexer-server-json ↑ Summary lib/IRC/Indexer.pm »