blib/lib/ExtUtils/Builder/Node.pm

filter: Statementstmt 92.5% 37 / 40 Branchbran 66.6% 4 / 6 Conditioncond 66.6% 10 / 15 MC/DCmcdc 50.0% 4 / 8 Subroutinesub 91.6% 11 / 12 Podpod 75.0% 6 / 8 totaltotal 80.9% 72 / 89 CC 10 SCAR 12.6
CC
10
Cov
84%
new
6.0
mergeable
6.0
newer_than
4.3
CRAP 3.5
« blib/lib/ExtUtils/Builder/Action/Function.pm ↑ Summary blib/lib/ExtUtils/Builder/MakeMaker.pm »
1 package ExtUtils::Builder::Node;
2 11 $ExtUtils::Builder::Node::VERSION = '0.020';
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use parent qw/ExtUtils::Builder::Action::Composite/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 30 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
Pod undocumented
11 30 my ($class, %args) = @_;
12 30 ▶ croak('Attribute target is not defined') if not $args{target};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"target"} 0 30 30
13 30 ▶ $args{actions} = [ map { $_->flatten } @{ $args{actions} // [] } ];
Condition100%2/2
$args{"actions"} // []
l!l
246
MC/DC100%1/1
$args{"actions"} // []
$args{"actions"}
Truth table100%2/2
A
A= $args{"actions"}
Aresult
11
00
14 30 ▶ $args{dependencies} //= [];
Condition100%2/2
$args{"dependencies"} //= []
l!l
264
MC/DC100%1/1
$args{"dependencies"} //= []
$args{"dependencies"}
Truth table100%2/2
A
A= $args{"dependencies"}
Aresult
11
00
15 30 ▶ $args{type} //= delete $args{phony} ? 'phony' : 'file';
Branch: 1 branch
BranchTrueFalseTotal
delete $args{'phony'} ? : 3 23 26
Condition100%2/2
$args{"type"} //= delete $args{"phony"} ? "phony" : "file"
l!l
426
MC/DC100%1/1
$args{"type"} //= delete $args{"phony"} ? "phony" : "file"
$args{"type"}
Truth table100%2/2
A
A= $args{"type"}
Aresult
11
00
16 30 return $class->SUPER::new(%args);
17 }
18  
19 30 ▶sub flatten {
Subroutine flatten: called CC=1 SCAR=0.0
Pod documented
20 30 my $self = shift;
21 30 return @{ $self->{actions} };
22 }
23  
24 57 ▶sub target {
Subroutine target: called CC=1 SCAR=0.0
Pod documented
25 57 my $self = shift;
26 57 return $self->{target};
27 }
28  
29 42 ▶sub dependencies {
Subroutine dependencies: called CC=1 SCAR=0.0
Pod documented
30 42 my $self = shift;
31 42 return @{ $self->{dependencies} };
32 }
33  
34 32 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod documented
35 32 my $self = shift;
36 32 return $self->{type};
37 }
38  
39 15 ▶sub phony {
Subroutine phony: called CC=1 SCAR=0.0
Pod documented
40 15 my $self = shift;
41 15 return $self->{type} eq 'phony';
42 }
43  
44 0 ▶sub mergeable {
Subroutine mergeable: not called CC=2 SCAR=17.9
Pod documented
45 0 my $self = shift;
46 0 ▶ return $self->{type} eq 'phony' && !@{ $self->{actions} };
Condition0%0/3
$self->{'type'} eq 'phony' && !@{$self->{'actions'};}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{'type'} eq 'phony' && !@{$self->{'actions'};}
$self->{'type'} eq 'phony' !@{$self->{'actions'};}
Truth table0%0/3
A && not(B)
A= $self->{'type'} eq 'phony'B= !@{$self->{'actions'};}
ABresult
0X0
100
111
47 }
48  
49 6 ▶sub newer_than {
Subroutine newer_than: called CC=4 SCAR=14.6
Pod undocumented
50 6 my ($self, $mtime) = @_;
51 6 ▶ return 1 if $self->{type} eq 'phony';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} eq "phony" 0 6 6
52 6 ▶ return -d $self->{target} || (-e _ && $mtime <= -M _);
Condition66%4/6
-d $self->{'target'} || -e _ && $mtime <= -M _
l!l&&r!l&&!r
051
-e _ and $mtime <= -M _
!ll&&!rl&&r
015
MC/DC33%1/3
-d $self->{'target'} || -e _ && $mtime <= -M _
-d $self->{'target'} -e _ $mtime <= -M _
Truth table50%2/4
A || B and C
A= -d $self->{'target'}B= -e _C= $mtime <= -M _
ABCresult
1XX1
0111
00X0
0100
53 }
54  
55 11 1;
56  
57 # ABSTRACT: An ExtUtils::Builder Node
58  
59 __END__
« blib/lib/ExtUtils/Builder/Action/Function.pm ↑ Summary blib/lib/ExtUtils/Builder/MakeMaker.pm »