IsDev/Role/Matcher/Child/Exists/Any/Dir.pm

filter: Statementstmt 88.5% 31 / 35 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 86.7% 46 / 53 CC 5 SCAR 8.4
CC
5
Cov
86%
child_exists_any_dir
4.0
child_exists_dir
2.1
BEGIN
1.0
CRAP 2.3
« IsDev.pm ↑ Summary IsDev/NegativeHeuristic/HomeDir.pm »
1 9 ▶use 5.008; # utf8
Subroutine BEGIN: called CC=1 SCAR=0.0
2 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Path::IsDev::Role::Matcher::Child::Exists::Any::Dir;
7  
8 9 our $VERSION = '1.001003';
9  
10 # ABSTRACT: Match if a path contains one of any of a list of directories
11  
12 9 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26 9 ▶use Role::Tiny qw( with );
Subroutine BEGIN: called CC=1 SCAR=0.0
27 9 with 'Path::IsDev::Role::Matcher::Child::Exists::Any';
28  
29  
30  
31  
32  
33  
34  
35  
36  
37 1 ▶sub child_exists_dir {
Subroutine child_exists_dir: called CC=2 SCAR=7.6
Pod documented
38 1 my ( $self, $result_object, $child ) = @_;
39  
40 1 my $child_path = $result_object->path->child($child);
41 1 my $ctx = { 'child_name' => $child, child_path => "$child_path", tests => [] };
42 1 my $tests = $ctx->{tests};
43  
44 1 ▶ if ( -d $child_path ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $child_path) 1 0 1
45 1 push @{$tests}, { 'child_path_isdir?' => 1 };
46 1 $result_object->add_reason( $self, 1, "$child_path is a dir", $ctx );
47 1 return 1;
48 }
49 0 push @{$tests}, { 'child_path_isdir?' => 0 };
50 0 $result_object->add_reason( $self, 0, "$child_path is not a dir", $ctx );
51  
52 0 return;
53 }
54  
55  
56  
57  
58  
59  
60  
61  
62  
63 9 ▶sub child_exists_any_dir {
Subroutine child_exists_any_dir: called CC=4 SCAR=13.9
Pod documented
64 9 my ( $self, $result_object, @children ) = @_;
65 9 for my $child (@children) {
66 15 ▶ return 1 if $self->child_exists( $result_object, $child ) and $self->child_exists_dir( $result_object, $child );
Branch: 1 branch
BranchTrueFalseTotal
if $self->child_exists($result_object, $child) and $self->child_exists_dir($result_object, $child) 1 14 15
Condition66%2/3
$self->child_exists($result_object, $child) and $self->child_exists_dir($result_object, $child)
!ll&&!rl&&r
1401
MC/DC50%1/2
$self->child_exists($result_object, $child) and $self->child_exists_dir($result_object, $child)
$self->child_exists($result_object, $child) $self->child_exists_dir($result_object, $child)
Truth table66%2/3
A and B
A= $self->child_exists($result_object, $child)B= $self->child_exists_dir($result_object, $child)
ABresult
0X0
100
111
67 }
68 8 return;
69 }
70  
71 9 1;
72  
73 __END__
« IsDev.pm ↑ Summary IsDev/NegativeHeuristic/HomeDir.pm »