blib/lib/ExtUtils/Builder/Action/Code.pm

filter: Statementstmt 95.1% 39 / 41 Branchbran 75.0% 6 / 8 Conditioncond 75.0% 6 / 8 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 10 / 10 Podpod 80.0% 4 / 5 totaltotal 85.7% 66 / 77 CC 8 SCAR 8.4
CC
8
Cov
89%
execute
4.0
new
3.0
to_command
2.1
CRAP 2.3
« blib/lib/ExtUtils/Builder/CPAN/Tool.pm ↑ Summary blib/lib/ExtUtils/Builder/FileSet.pm »
1 package ExtUtils::Builder::Action::Code;
2 9 $ExtUtils::Builder::Action::Code::VERSION = '0.020';
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 ▶use parent 'ExtUtils::Builder::Action::Perl';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use ExtUtils::Builder::Util 'get_perl';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 23 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
12 23 my ($class, %args) = @_;
13 23 ▶ Carp::croak('Need to define code') if !$args{code};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"code"} 0 23 23
14 23 ▶ $args{modules} //= [];
Condition100%2/2
$args{"modules"} //= []
l!l
320
MC/DC100%1/1
$args{"modules"} //= []
$args{"modules"}
Truth table100%2/2
A
A= $args{"modules"}
Aresult
11
00
15 23 my $self = $class->SUPER::new(%args);
16 23 return $self;
17 }
18  
19 29 ▶sub modules {
Subroutine modules: called CC=1 SCAR=0.0
Pod documented
20 29 my $self = shift;
21 29 return @{ $self->{modules} };
22 }
23  
24 21 ▶sub execute {
Subroutine execute: called CC=4 SCAR=14.0
Pod documented
25 21 my ($self, %opts) = @_;
26 21 my $code = $self->to_code();
27 21 ▶ if (!$opts{quiet}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($opts{"quiet"}) 12 9 21
28 12 ▶ my $message = $self->{message} // $code;
Condition66%2/3
$self->{"message"} // $code
l!l&&r!l&&!r
1110
MC/DC0%0/2
$self->{"message"} // $code
$self->{"message"} $code
Truth table66%2/3
A // B
A= $self->{"message"}B= $code
ABresult
1X1
011
000
29 12 print "$message\n";
30 }
31 21 ▶ eval $code . '; 1' or die $@;
Branch: 1 branch
BranchTrueFalseTotal
eval $code . '; 1' or die $@ 21 0 21
32 21 return;
33 }
34  
35 29 ▶sub to_code {
Subroutine to_code: called CC=2 SCAR=7.0
Pod documented
36 29 my ($self, %opts) = @_;
37 0 ▶ my @modules = $opts{skip_loading} ? () : map { "require $_" } $self->modules;
Branch: 1 branch
BranchTrueFalseTotal
$opts{'skip_loading'} ? : 7 22 29
38 29 return join '; ', @modules, $self->{code};
39 }
40  
41 4 ▶sub to_command {
Subroutine to_command: called CC=2 SCAR=7.2
Pod documented
42 4 my ($self, %opts) = @_;
43 0 my @modules = map { "-M$_" } $self->modules;
44 4 ▶ my $perl = $opts{perl} // get_perl(%opts);
Condition66%2/3
$opts{"perl"} // get_perl(%opts)
l!l&&r!l&&!r
130
MC/DC0%0/2
$opts{"perl"} // get_perl(%opts)
$opts{"perl"} get_perl(%opts)
Truth table66%2/3
A // B
A= $opts{"perl"}B= get_perl(%opts)
ABresult
1X1
011
000
45 4 return [ $perl, @modules, '-e', $self->to_code(skip_loading => 'main') ];
46 }
47  
48 9 1;
49  
50 #ABSTRACT: Action objects for perl code
51  
52 __END__
« blib/lib/ExtUtils/Builder/CPAN/Tool.pm ↑ Summary blib/lib/ExtUtils/Builder/FileSet.pm »