Parts.pm

filter: Statementstmt 100% 47 / 49 (2 uncoverable) Branchbran 100% 9 / 10 (1 uncoverable) Conditioncond 100% 6 / 6 MC/DCmcdc 100% 4 / 4 Subroutinesub 100% 13 / 13 Podpod 100% 6 / 6 totaltotal 100% 85 / 88 (3 uncoverable) CC 8 SCAR 13.4
CC
8
Cov
100%
new
8.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.8
↑ Summary Parts/Common.pm »
1 package Run::Parts;
2  
3 # ABSTRACT: Offers functionality of Debian's run-parts tool in Perl
4  
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use File::Slurp 9999.17;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Run::Parts::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 5 our $VERSION = '0.09'; # VERSION generated by DZP::OurPkgVersion
13  
14  
15 10 ▶sub new {
Subroutine new: called CC=8 SCAR=20.8
Pod documented
16 10 my $self = {};
17 10 bless($self, shift);
18 10 $self->{dir} = shift;
19  
20 10 my $backend = shift;
21 10 ▶ if (defined $backend) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $backend) { } 8 2 10
22 8 ▶ if (ref $backend) {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $backend) { } 1 7 8
elsif ($backend eq 'debian' or $backend eq 'run-parts') { } 3 4 7
elsif ($backend eq 'perl' or $backend eq 'module') { } 3 1 4
23 1 $self->{backend} = ref($backend)->new($self->{dir});
24 ▶ } elsif ($backend eq 'debian' or $backend eq 'run-parts') {
Condition100%3/3
$backend eq "debian" or $backend eq "run-parts"
l!l&&r!l&&!r
214
MC/DC100%2/2
$backend eq "debian" or $backend eq "run-parts"
$backend eq "debian" $backend eq "run-parts"
Truth table100%3/3
A or B
A= $backend eq "debian"B= $backend eq "run-parts"
ABresult
1X1
011
000
25 5 ▶ use Run::Parts::Debian;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 3 $self->{backend} = Run::Parts::Debian->new($self->{dir});
27 ▶ } elsif ($backend eq 'perl' or $backend eq 'module') {
Condition100%3/3
$backend eq "perl" or $backend eq "module"
l!l&&r!l&&!r
211
MC/DC100%2/2
$backend eq "perl" or $backend eq "module"
$backend eq "perl" $backend eq "module"
Truth table100%3/3
A or B
A= $backend eq "perl"B= $backend eq "module"
ABresult
1X1
011
000
28 5 ▶ use Run::Parts::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 3 $self->{backend} = Run::Parts::Perl->new($self->{dir});
30 } else {
31 1 warn "Unknown backend $backend in use";
32 1 require $backend;
33 # uncoverable statement
34 0 $self->{backend} = $backend->new($self->{dir});
35 }
36 } else {
37 # uncoverable branch false
38 2 ▶ if (-x '/bin/run-parts') {
Branch: 1 branch
BranchTrueFalseTotal
if (-x '/bin/run-parts') { } 2 0 2
39 2 $self->{backend} = Run::Parts::Debian->new($self->{dir});
40 } else {
41 # uncoverable statement
42 0 $self->{backend} = Run::Parts::Perl->new($self->{dir});
43 }
44 }
45  
46 9 return $self;
47 }
48  
49  
50 52 ▶sub run_parts_command {
Subroutine run_parts_command: called CC=1 SCAR=0.0
Pod documented
51 52 my $self = shift;
52 52 return $self->{backend}->run_parts_command(@_);
53 }
54  
55  
56 28 ▶sub list {
Subroutine list: called CC=1 SCAR=0.0
Pod documented
57 28 my $self = shift;
58 28 return $self->run_parts_command('list');
59 }
60  
61  
62 16 ▶sub test {
Subroutine test: called CC=1 SCAR=0.0
Pod documented
63 16 my $self = shift;
64 16 return $self->run_parts_command('test');
65 }
66  
67  
68 8 ▶sub run {
Subroutine run: called CC=1 SCAR=0.0
Pod documented
69 8 my $self = shift;
70 8 return $self->run_parts_command();
71 }
72  
73  
74 12 ▶sub concat {
Subroutine concat: called CC=1 SCAR=0.0
Pod documented
75 12 my $self = shift;
76 12 return lines(map { read_file($_, { chomp => 1 }) } $self->list());
77 }
78  
79  
80 5 42; # End of Run::Parts
81  
82 __END__
↑ Summary Parts/Common.pm »