| 1 | package ExtUtils::Builder::Action::Function; | ||||||||||||||||||||||||||||||||||
| 2 | 2 | $ExtUtils::Builder::Action::Function::VERSION = '0.020'; | |||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use ExtUtils::Builder::Util 'get_perl'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use parent 'ExtUtils::Builder::Action::Perl'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 12 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | croak 'Attribute module is not defined' if not defined $args{module}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | croak 'Attribute function is not defined' if not defined $args{function}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 15 | 1 | $args{fullname} = join '::', $args{module}, $args{function}; | |||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | $args{exports} ||= !!0; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"exports"} ||=
MC/DC0%0/1
$args{"exports"} ||=
$args{"exports"}
Truth table50%1/2
A
A= $args{"exports"}
| |||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | $args{arguments} //= []; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"arguments"} //= []
MC/DC0%0/1
$args{"arguments"} //= []
$args{"arguments"}
Truth table50%1/2
A
A= $args{"arguments"}
| |||||||||||||||||||||||||||||||||||
| 18 | 1 | my $self = $class->SUPER::new(%args); | |||||||||||||||||||||||||||||||||
| 19 | 1 | return $self; | |||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub modules { | ||||||||||||||||||||||||||||||||
|
Subroutine
modules: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 23 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 24 | 0 | return $self->{module}; | |||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub module { | ||||||||||||||||||||||||||||||||
|
Subroutine
module: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 28 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 29 | 0 | return $self->{module}; | |||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub function { | ||||||||||||||||||||||||||||||||
|
Subroutine
function: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 33 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 34 | 0 | return $self->{function}; | |||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | 6 | ▶ | sub arguments { | ||||||||||||||||||||||||||||||||
|
Subroutine
arguments: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 38 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||
| 39 | 6 | return @{ $self->{arguments} }; | |||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||
| 42 | 2 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 43 | 2 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||
| 44 | 2 | my $module = $self->{module}; | |||||||||||||||||||||||||||||||||
| 45 | 2 | (my $filename = $module) =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||
| 46 | 2 | require "$filename.pm"; | |||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||
| 48 | 2 | ▶ | if (!$args{quiet}) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | my $message = $self->{message} // sprintf "%s(%s)", $self->{fullname}, join ", ", $self->arguments; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"message"} // sprintf('%s(%s)', $self->{"fullname"}, join(", ", $self->arguments))
MC/DC0%0/1
$self->{"message"} // sprintf('%s(%s)', $self->{"fullname"}, join(", ", $self->arguments))
$self->{"message"}
Truth table50%1/2
A
A= $self->{"message"}
| |||||||||||||||||||||||||||||||||||
| 50 | 1 | print "$message\n"; | |||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||
| 53 | 2 | ▶ | my $code = do { no strict 'refs'; \&{ $self->{fullname} } }; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 54 | 2 | $code->($self->arguments); | |||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||
| 57 | 2 | ▶ | sub to_code { | ||||||||||||||||||||||||||||||||
|
Subroutine
to_code: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 58 | 2 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||
| 59 | 2 | ▶ | my $shortcut = $args{skip_loading} && $args{skip_loading} eq 'main' && $self->{exports}; | ||||||||||||||||||||||||||||||||
|
Condition66%4/6
$args{'skip_loading'} && $args{'skip_loading'} eq 'main' && $self->{'exports'}
$args{"skip_loading"} and $args{"skip_loading"} eq "main"
MC/DC33%1/3
$args{'skip_loading'} && $args{'skip_loading'} eq 'main' && $self->{'exports'}
$args{"skip_loading"}
$args{"skip_loading"} eq "main"
$self->{'exports'}
Truth table50%2/4
A and B && C
A= $args{"skip_loading"}B= $args{"skip_loading"} eq "main"C= $self->{'exports'}
| |||||||||||||||||||||||||||||||||||
| 60 | 2 | ▶ | my $name = $shortcut ? $self->{function} : $self->{fullname}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 61 | 2 | ▶ | my @modules = $args{skip_loading} ? () : "require $self->{module}"; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 62 | 2 | ▶ | my $arguments = $self->arguments ? do { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 63 | 2 | require Data::Dumper; (Data::Dumper->new([ [ $self->arguments ] ])->Terse(1)->Indent(0)->Dump =~ /^ \[ (.*) \] $/x)[0] | |||||||||||||||||||||||||||||||||
| 64 | } : ''; | ||||||||||||||||||||||||||||||||||
| 65 | 2 | return join '; ', @modules, sprintf '%s(%s)', $name, $arguments; | |||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | sub to_command { | ||||||||||||||||||||||||||||||||
|
Subroutine
to_command: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 69 | 1 | my ($self, %opts) = @_; | |||||||||||||||||||||||||||||||||
| 70 | 1 | ▶ | my $module = $self->{exports} eq 'explicit' ? "-M$self->{module}=$self->{function}" : "-M$self->{module}"; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 71 | 1 | ▶ | my $perl = $opts{perl} // get_perl(%opts); | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"perl"} // get_perl(%opts)
MC/DC0%0/2
$opts{"perl"} // get_perl(%opts)
$opts{"perl"}
get_perl(%opts)
Truth table33%1/3
A // B
A= $opts{"perl"}B= get_perl(%opts)
| |||||||||||||||||||||||||||||||||||
| 72 | 1 | return [ $perl, $module, '-e', $self->to_code(skip_loading => 'main') ]; | |||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||
| 75 | 2 | 1; | |||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||
| 77 | #ABSTRACT: Actions for perl function calls | ||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||
| 79 | __END__ | ||||||||||||||||||||||||||||||||||