Profile/Perl.pm

filter: Statementstmt 70.3% 45 / 64 Branchbran 33.3% 4 / 12 Conditioncond 26.4% 9 / 34 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 83.3% 10 / 12 Podpod 0.0% 0 / 2 totaltotal 47.8% 68 / 142 CC 19 SCAR 31.9
CC
19
Cov
53%
process_linker
55.5
__ANON__
20.0
process_compiler
4.4
CRAP 24.2
« ParseXS.pm ↑ Summary Compiler/VMS.pm »
1 package ExtUtils::Builder::Profile::Perl;
2 1 $ExtUtils::Builder::Profile::Perl::VERSION = '0.038';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use ExtUtils::Builder::Util 0.018 'split_like_shell';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Basename 'dirname';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Spec::Functions qw/catdir/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶sub _get_var {
Subroutine _get_var: called CC=2 SCAR=8.1
11 4 my ($config, $opts, $key) = @_;
12 4 ▶ return delete $opts->{$key} // $config->get($key);
Condition33%1/3
delete $opts->{$key} // $config->get($key)
l!l&&r!l&&!r
040
MC/DC0%0/2
delete $opts->{$key} // $config->get($key)
delete $opts->{$key} $config->get($key)
Truth table33%1/3
A // B
A= delete $opts->{$key}B= $config->get($key)
ABresult
1X1
011
000
13 }
14  
15 3 ▶sub _split_var {
Subroutine _split_var: called CC=2 SCAR=7.2
16 3 my ($config, $opts, $key) = @_;
17 3 ▶ return delete $opts->{$key} // [ split_like_shell($config->get($key)) ];
Condition50%1/2
delete $opts->{$key} // [split_like_shell($config->get($key))]
l!l
03
MC/DC0%0/1
delete $opts->{$key} // [split_like_shell($config->get($key))]
delete $opts->{$key}
Truth table50%1/2
A
A= delete $opts->{$key}
Aresult
11
00
18 }
19  
20 1 ▶sub process_compiler {
Subroutine process_compiler: called CC=4 SCAR=14.8
Pod undocumented
21 1 my ($class, $compiler, $opts) = @_;
22 1 my $config = delete $opts->{config};
23 1 my $incdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE');
24 1 my $os = _get_var($config, $opts, 'osname');
25 1 my $osver = _get_var($config, $opts, 'osvers');
26 1 my ($osmajor) = $osver =~ /^(\d+)/;
27 1 ▶ if ($os eq 'darwin' && $^X eq '/usr/bin/perl' && $osmajor >= 18) {
Branch: 1 branch
BranchTrueFalseTotal
if ($os eq 'darwin' and $^X eq '/usr/bin/perl' and $osmajor >= 18) { } 0 1 1
Condition33%2/6
$os eq "darwin" and $^X eq "/usr/bin/perl" and $osmajor >= 18
!ll&&!rl&&r
100
$os eq "darwin" and $^X eq "/usr/bin/perl"
!ll&&!rl&&r
100
MC/DC0%0/3
$os eq "darwin" and $^X eq "/usr/bin/perl" and $osmajor >= 18
$os eq "darwin" $^X eq "/usr/bin/perl" $osmajor >= 18
Truth table25%1/4
A and B and C
A= $os eq "darwin"B= $^X eq "/usr/bin/perl"C= $osmajor >= 18
ABCresult
0XX0
10X0
1100
1111
28 0 $compiler->add_argument(value => [ '-iwithsysroot', $incdir ], ranking => $compiler->default_include_ranking + 1);
29 } else {
30 1 ▶ $compiler->add_include_dirs([$incdir], ranking => sub { $_[0] + 1 });
Subroutine __ANON__: called CC=1 SCAR=0.0
31 }
32 1 $compiler->add_argument(ranking => 60, value => _split_var($config, $opts, 'ccflags'));
33 1 $compiler->add_argument(ranking => 65, value => _split_var($config, $opts, 'optimize'));
34 1 return;
35 }
36  
37 1 my $rpath_regex = qr/ ( (?<! \w ) (?: -Wl,-R | -Wl,-rpath | -R\ ? ) \S+ ) /x;
38  
39 1 my %needs_relinking = map { $_ => 1 } qw/MSWin32 cygwin aix VMS/;
40  
41 1 ▶sub process_linker {
Subroutine process_linker: called CC=11 SCAR=40.2
Pod undocumented
42 1 my ($class, $linker, $opts) = @_;
43 1 my $config = delete $opts->{config};
44 1 $linker->add_argument(ranking => 60, value => _split_var($config, $opts, 'ldflags'));
45 1 ▶ if ($linker->export eq 'some') {
Branch: 1 branch
BranchTrueFalseTotal
if ($linker->export eq "some") 0 1 1
46 0 ▶ $linker->add_option_filter(sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
47 0 my ($self, $from, $to, %opts) = @_;
48 0 ▶ $opts{dl_name} //= $opts{module_name} if $opts{module_name};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"module_name"} 0 0 0
Condition0%0/3
$opts{"dl_name"} //= $opts{"module_name"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{"dl_name"} //= $opts{"module_name"}
$opts{"dl_name"} $opts{"module_name"}
Truth table0%0/3
A //= B
A= $opts{"dl_name"}B= $opts{"module_name"}
ABresult
1X1
011
000
49 0 ▶ $opts{dl_file} //= do {
Condition0%0/3
$opts{"dl_file"} //= do { (my $short = $opts{"dl_name"}) =~ s/.*:://; catdir(dirname($to), "$short") }
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{"dl_file"} //= do { (my $short = $opts{"dl_name"}) =~ s/.*:://; catdir(dirname($to), "$short") }
$opts{"dl_file"} do { (my $short = $opts{"dl_name"}) =~ s/.*:://; catdir(dirname($to), "$short") }
Truth table0%0/3
A //= B
A= $opts{"dl_file"}B= do { (my $short = $opts{"dl_name"}) =~ s/.*:://; catdir(dirname($to), "$short") }
ABresult
1X1
011
000
50 0 (my $short = $opts{dl_name}) =~ s/.*:://;
51 0 catdir(dirname($to), "$short");
52 };
53 0 return ($from, $to, %opts);
54 0 });
55 }
56 1 my $os = _get_var($config, $opts, 'osname');
57 1 ▶ my $needs_libperl = $needs_relinking{$os} || ($os eq 'android' && _get_var($config, $opts, 'useshrplib') eq 'true');
Condition33%2/6
$needs_relinking{$os} || $os eq 'android' && _get_var($config, $opts, 'useshrplib') eq 'true'
l!l&&r!l&&!r
001
$os eq "android" and _get_var($config, $opts, "useshrplib") eq "true"
!ll&&!rl&&r
100
MC/DC0%0/3
$needs_relinking{$os} || $os eq 'android' && _get_var($config, $opts, 'useshrplib') eq 'true'
$needs_relinking{$os} $os eq "android" _get_var($config, $opts, "useshrplib") eq "true"
Truth table25%1/4
A || B and C
A= $needs_relinking{$os}B= $os eq "android"C= _get_var($config, $opts, "useshrplib") eq "true"
ABCresult
1XX1
0111
00X0
0100
58 1 ▶ if ($linker->type eq 'executable' or $linker->type eq 'shared-library' or ($linker->type eq 'loadable-object' and $needs_libperl)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_libperl) 0 1 1
Condition33%3/9
$linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_libperl
l!l&&r!l&&!r
001
$linker->type eq "executable" or $linker->type eq "shared-library"
l!l&&r!l&&!r
001
$linker->type eq "loadable-object" and $needs_libperl
!ll&&!rl&&r
010
MC/DC0%0/4
$linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_libperl
$linker->type eq "executable" $linker->type eq "shared-library" $linker->type eq "loadable-object" $needs_libperl
Truth table20%1/5
A or B or C and D
A= $linker->type eq "executable"B= $linker->type eq "shared-library"C= $linker->type eq "loadable-object"D= $needs_libperl
ABCDresult
1XXX1
01XX1
00111
000X0
00100
59 0 my ($libperl, $libext, $so) = map { _get_var($config, $opts, $_) } qw/libperl lib_ext so/;
60 0 my ($lib) = $libperl =~ / \A (?:lib)? ( \w* perl \w* ) (?: \. $so | $libext) \b /msx;
61 0 ▶ $linker->add_libraries([$lib], ranking => sub { $_[0] - 1 });
Subroutine __ANON__: not called CC=1 SCAR=6.9
62  
63 0 my $libdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE');
64 0 $linker->add_library_dirs([$libdir]);
65 0 $linker->add_argument(ranking => 80, value => _split_var($config, $opts, 'perllibs'));
66 }
67 1 ▶ if ($linker->type eq 'executable') {
Branch: 1 branch
BranchTrueFalseTotal
if ($linker->type eq "executable") 0 1 1
68 0 ▶ my $rpath = $opts->{rpath} // [ split_like_shell($config->get('ccdlflags') =~ $rpath_regex) ];
Condition0%0/2
$opts->{"rpath"} // [split_like_shell($config->get("ccdlflags") =~ /$rpath_regex/)]
l!l
00
MC/DC0%0/1
$opts->{"rpath"} // [split_like_shell($config->get("ccdlflags") =~ /$rpath_regex/)]
$opts->{"rpath"}
Truth table0%0/2
A
A= $opts->{"rpath"}
Aresult
11
00
69 0 ▶ $linker->add_argument(ranking => 40, value => $rpath) if @{$rpath};
Branch: 1 branch
BranchTrueFalseTotal
if @{$rpath;} 0 0 0
70 }
71 1 return;
72 }
73  
74 1 1;
75  
76 # ABSTRACT: A profile for compiling and linking against perl
77  
78 __END__
« ParseXS.pm ↑ Summary Compiler/VMS.pm »