Profile/Perl.pm

filter: Statementstmt 69.8% 44 / 63 Branchbran 33.3% 4 / 12 Conditioncond 25.0% 7 / 28 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 83.3% 10 / 12 Podpod 0.0% 0 / 2 totaltotal 49.2% 65 / 132 CC 17 SCAR 28.5
CC
17
Cov
53%
process_linker
41.3
__ANON__
20.0
process_compiler
4.4
CRAP 17.3
« Compiler/VMS.pm ↑ Summary Compiler/MSVC.pm »
1 package ExtUtils::Builder::Profile::Perl;
2 1 $ExtUtils::Builder::Profile::Perl::VERSION = '0.037';
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=9 SCAR=37.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 ▶ if ($linker->type eq 'executable' or $linker->type eq 'shared-library' or ($linker->type eq 'loadable-object' and $needs_relinking{$os})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_relinking{$os}) 0 1 1
Condition33%3/9
$linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_relinking{$os}
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_relinking{$os}
!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_relinking{$os}
$linker->type eq "executable" $linker->type eq "shared-library" $linker->type eq "loadable-object" $needs_relinking{$os}
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_relinking{$os}
ABCDresult
1XXX1
01XX1
00111
000X0
00100
58 0 my ($libperl, $libext, $so) = map { _get_var($config, $opts, $_) } qw/libperl lib_ext so/;
59 0 my ($lib) = $libperl =~ / \A (?:lib)? ( \w* perl \w* ) (?: \. $so | $libext) \b /msx;
60 0 ▶ $linker->add_libraries([$lib], ranking => sub { $_[0] - 1 });
Subroutine __ANON__: not called CC=1 SCAR=6.9
61  
62 0 my $libdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE');
63 0 $linker->add_library_dirs([$libdir]);
64 0 $linker->add_argument(ranking => 80, value => _split_var($config, $opts, 'perllibs'));
65 }
66 1 ▶ if ($linker->type eq 'executable') {
Branch: 1 branch
BranchTrueFalseTotal
if ($linker->type eq "executable") 0 1 1
67 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
68 0 ▶ $linker->add_argument(ranking => 40, value => $rpath) if @{$rpath};
Branch: 1 branch
BranchTrueFalseTotal
if @{$rpath;} 0 0 0
69 }
70 1 return;
71 }
72  
73 1 1;
74  
75 # ABSTRACT: A profile for compiling and linking against perl
76  
77 __END__
« Compiler/VMS.pm ↑ Summary Compiler/MSVC.pm »