Inline/MakeMaker.pm

filter: Statementstmt 29.5% 18 / 61 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 21.7% 23 / 106 CC 19 SCAR 56.7
CC
19
Cov
19%
WriteMakefile
380.0
WriteInlineMakefile
2.0
BEGIN
1.0
CRAP 289.1
↑ Summary Inline.pm »
1 package Inline::MakeMaker;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use ExtUtils::MakeMaker();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our @EXPORT = qw(WriteMakefile WriteInlineMakefile);
10 1 our $VERSION = '0.85';
11  
12 sub WriteInlineMakefile {
13 0 ▶ carp <<EOF;
Subroutine WriteInlineMakefile: not called CC=1 SCAR=6.9
Pod undocumented
14  
15 ======================== DEPRECATION ALERT ======================
16  
17 WriteInlineMakefile was deprecated in 2002. This warning is from 2014.
18 WriteInlineMakefile will soon be removed. Please change this Makefile.PL
19 to use WriteMakefile instead.
20  
21 ========================== MESSAGE ENDS =========================
22  
23 EOF
24 0 goto &WriteMakefile;
25 }
26  
27 sub WriteMakefile {
28 0 ▶ my %args = @_;
Subroutine WriteMakefile: not called CC=19 SCAR=59.4
Pod undocumented
29 my $name = $args{NAME}
30 0 ▶ or croak "Inline::MakeMaker::WriteMakefile requires the NAME parameter\n";
Branch: 1 branch
BranchTrueFalseTotal
my $name = $args{"NAME"} or croak("Inline::MakeMaker::WriteMakefile requires the NAME parameter\n") 0 0 0
31 0 my $version = '';
32  
33 0 ▶ croak <<END unless (defined $args{VERSION} or defined $args{VERSION_FROM});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"VERSION"} or defined $args{"VERSION_FROM"} 0 0 0
Condition0%0/3
defined $args{"VERSION"} or defined $args{"VERSION_FROM"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $args{"VERSION"} or defined $args{"VERSION_FROM"}
defined $args{"VERSION"} defined $args{"VERSION_FROM"}
Truth table0%0/3
A or B
A= defined $args{"VERSION"}B= defined $args{"VERSION_FROM"}
ABresult
1X1
011
000
34 Inline::MakeMaker::WriteMakefile requires either the VERSION or VERSION_FROM
35 parameter.
36 END
37 0 ▶ if (defined $args{VERSION}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{'VERSION'}) { } 0 0 0
38 0 $version = $args{VERSION};
39 }
40 else {
41 $version = ExtUtils::MM_Unix->parse_version($args{VERSION_FROM})
42 0 ▶ or croak "Can't determine version for $name\n";
Branch: 1 branch
BranchTrueFalseTotal
$version = "ExtUtils::MM_Unix"->parse_version($args{"VERSION_FROM"}) or croak("Can't determine version for $name\n") 0 0 0
43 }
44 0 ▶ croak "Invalid 'version.pm' version '$version' for '$name'.\n"
Branch: 1 branch
BranchTrueFalseTotal
unless version::is_lax($version) 0 0 0
45 unless version::is_lax($version);
46  
47 # Provide a convenience rule to clean up Inline's messes
48 $args{clean} = { FILES => "_Inline *.inl " }
49 0 ▶ unless defined $args{clean};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"clean"} 0 0 0
50  
51 # Add Inline to the dependencies
52 0 ▶ $args{PREREQ_PM}{Inline} = '0.44' unless defined $args{PREREQ_PM}{Inline};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"PREREQ_PM"}{"Inline"} 0 0 0
53  
54 0 my $mm = &ExtUtils::MakeMaker::WriteMakefile(%args);
55  
56 0 my (@objects, @obj_rules);
57  
58 0 ▶ if (@{$mm->{PMLIBDIRS}} && $mm->{PM}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$mm->{'PMLIBDIRS'};} and $mm->{'PM'}) { } 0 0 0
Condition0%0/3
@{$mm->{"PMLIBDIRS"};} and $mm->{"PM"}
!ll&&!rl&&r
000
MC/DC0%0/2
@{$mm->{"PMLIBDIRS"};} and $mm->{"PM"}
@{$mm->{"PMLIBDIRS"};} $mm->{"PM"}
Truth table0%0/3
A and B
A= @{$mm->{"PMLIBDIRS"};}B= $mm->{"PM"}
ABresult
0X0
100
111
59 # Sort them longest first so we'll match subdirectories before their parents
60 0 my @libdirs = sort { length($b) <=> length($a) } @{$mm->{PMLIBDIRS}};
61  
62 0 for my $path (keys %{$mm->{PM}}) {
63 0 for my $lib (@libdirs) {
64 0 ▶ if (index($path,$lib) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($path, $lib) == 0) 0 0 0
65 0 my ($vol, $dirs, $file) = File::Spec->splitpath(substr($path, length($lib)+1));
66 0 my @dirs = File::Spec->splitdir($dirs);
67 0 ▶ pop @dirs unless length($dirs[$#dirs]);
Branch: 1 branch
BranchTrueFalseTotal
unless length $dirs[$#dirs] 0 0 0
68 0 ▶ next unless ($file =~ /.pm$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $file =~ /.pm$/ 0 0 0
69 0 $file =~ s/\.[^.]+$//;
70  
71 0 push @objects, join('::', @dirs, $file);
72 0 push @obj_rules, join('-', @dirs, "$file.inl");
73 0 last;
74 }
75 0 croak "Failed to find module path for '$path'";
76 }
77 }
78 } else {
79 # no modules found in PMLIBDIRS so assume we've just got $name to do
80 0 @objects = $name;
81 0 $name =~ s/::/-/g;
82 0 @obj_rules = ("$name.inl");
83 }
84  
85 0 ▶ if (@objects) {
Branch: 1 branch
BranchTrueFalseTotal
if (@objects) 0 0 0
86 0 ▶ open MAKEFILE, '>> Makefile'
Branch: 1 branch
BranchTrueFalseTotal
open MAKEFILE, ">> Makefile" or croak("Inline::MakeMaker::WriteMakefile can't append to Makefile:\n$!") 0 0 0
87 or croak "Inline::MakeMaker::WriteMakefile can't append to Makefile:\n$!";
88  
89 0 print MAKEFILE <<MAKEFILE;
90 # Well, not quite. Inline::MakeMaker is adding this:
91  
92 # --- MakeMaker inline section:
93  
94 MAKEFILE
95 0 for (0..$#objects) {
96 # the subdivision in hashes is done to avoid {}, which break dmake
97 0 print MAKEFILE <<MAKEFILE;
98 $obj_rules[$_] : pm_to_blib
99 \t\$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -M$objects[$_] -e"my %A = (modinlname => '$obj_rules[$_]', module => '$objects[$_]'); my %S = (API => \\%A); Inline::satisfy_makefile_dep(\\%S);" $version \$(INST_ARCHLIB)
100 MAKEFILE
101 }
102  
103 0 print MAKEFILE "\ndynamic :: ",join(' ',@obj_rules),"\n";
104  
105 0 print MAKEFILE <<MAKEFILE;
106  
107 # The End is here.
108 MAKEFILE
109  
110 0 close MAKEFILE;
111 }
112 }
113  
114 1 1;
↑ Summary Inline.pm »