| 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
| |||||||||||||||||||||
| 14 | 23 | ▶ | $args{modules} //= []; | ||||||||||||||||||
|
Condition100%2/2
$args{"modules"} //= []
MC/DC100%1/1
$args{"modules"} //= []
$args{"modules"}
Truth table100%2/2
A
A= $args{"modules"}
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 28 | 12 | ▶ | my $message = $self->{message} // $code; | ||||||||||||||||||
|
Condition66%2/3
$self->{"message"} // $code
MC/DC0%0/2
$self->{"message"} // $code
$self->{"message"}
$code
Truth table66%2/3
A // B
A= $self->{"message"}B= $code
| |||||||||||||||||||||
| 29 | 12 | print "$message\n"; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | 21 | ▶ | eval $code . '; 1' or die $@; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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)
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)
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||