example/unbundle.pl

filter: Statementstmt 89.4% 51 / 57 Branchbran 72.7% 16 / 22 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 87.3% 83 / 95 CC 13 SCAR 19.3
CC
13
Cov
85%
add_plugins
12.1
BEGIN
2.1
BEGIN
1.0
CRAP 6.9
« blib/lib/Dist/Zilla/Plugin/Author/Plicease/Tests.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/Plicease/Upload.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Dist::Zilla::PluginBundle::Author::Plicease;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Config::INI::Reader;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Path::Tiny qw( path );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use File::Temp qw( tempdir );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶BEGIN { @INC = map { ref($_) ? $_ : path($_)->absolute->stringify } @INC }
Subroutine BEGIN: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 17 17
9  
10 1 my $nl = 0;
11 1 my $in_config;
12  
13 1 ▶if($ARGV[0] eq '--default')
Branch: 1 branch
BranchTrueFalseTotal
if ($ARGV[0] eq '--default') { } 0 1 1
14 {
15 0 $in_config = {};
16 0 warn "using default";
17 0 chdir(tempdir( CLEANUP => 1));
18 0 mkdir 'My-Dist';
19 0 chdir 'My-Dist';
20 }
21 else
22 {
23 1 ▶ die "run from the directory with the dist.ini file" unless -r 'dist.ini';
Branch: 1 branch
BranchTrueFalseTotal
unless -r "dist.ini" 0 1 1
24 1 $in_config = Config::INI::Reader->read_file('dist.ini')->{'@Author::Plicease'};
25 }
26  
27 1 ▶die "unable to find [\@Author::Plicease] in your dist.ini" unless defined $in_config;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $in_config 0 1 1
28  
29 1 my $bundle = Bundle->new;
30  
31 1 Dist::Zilla::PluginBundle::Author::Plicease::configure($bundle);
32  
33 1 chdir(Path::Tiny->rootdir);
34  
35 package
36 Bundle;
37  
38 1 ▶sub new { bless {} }
Subroutine new: called CC=1 SCAR=0.0
39 41 ▶sub payload { $in_config }
Subroutine payload: called CC=1 SCAR=0.0
40 23 ▶sub _my_add_plugin { shift->add_plugins(@_) }
Subroutine _my_add_plugin: called CC=1 SCAR=0.0
41  
42 sub add_plugins
43 23 ▶{
Subroutine add_plugins: called CC=12 SCAR=24.9
44 23 shift; # self
45 23 ▶ foreach my $item (map { ref $_ ? [@$_] : [$_] } @_)
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 31 0 31
46 {
47 31 ▶ if(ref($item) eq 'ARRAY')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $item eq 'ARRAY') { } 31 0 31
48 {
49 31 ▶ my %config = ref $item->[-1] eq 'HASH' ? %{ pop @$item } : ();
Branch: 1 branch
BranchTrueFalseTotal
ref $item->[-1] eq 'HASH' ? : 14 17 31
50 31 my($moniker, $name) = @$item;
51  
52 31 ▶ print "\n" if $nl && %config;
Branch: 1 branch
BranchTrueFalseTotal
if $nl and %config 5 26 31
Condition100%3/3
$nl and %config
!ll&&!rl&&r
10165
MC/DC100%2/2
$nl and %config
$nl %config
Truth table100%3/3
A and B
A= $nlB= %config
ABresult
0X0
100
111
53 31 ▶ if(defined $name)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name) { } 1 30 31
54 {
55 1 print "[$moniker / $name]\n";
56 }
57 else
58 {
59 30 print "[$moniker]\n";
60 }
61  
62 31 foreach my $k (sort keys %config)
63 {
64 23 my $v = $config{$k};
65 23 ▶ $v = [ $v ] unless ref $v;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $v 20 3 23
66 23 print "$k = $_\n" for @$v;
67 }
68  
69 31 ▶ if(%config)
Branch: 1 branch
BranchTrueFalseTotal
if (%config) { } 10 21 31
70 {
71 10 print "\n";
72 10 $nl = 0;
73 }
74 else
75 {
76 21 $nl = 1;
77 }
78  
79 }
80 else
81 {
82 0 die "do not know how to handle " . ref $item;
83 }
84 }
85 }
86  
« blib/lib/Dist/Zilla/Plugin/Author/Plicease/Tests.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/Plicease/Upload.pm »