lib/Module/Install/Makefile.pm

filter: Statementstmt 72.9% 143 / 196 Branchbran 50.0% 45 / 90 Conditioncond 43.2% 29 / 67 MC/DCmcdc 13.1% 5 / 38 Subroutinesub 72.0% 18 / 25 Podpod 0.0% 0 / 15 totaltotal 55.6% 240 / 431 CC 78 SCAR 36.6
CC
78
Cov
61%
write
85.8
prompt
30.0
makemaker_args
26.0
CRAP 38.7
« lib/Module/Install/Admin/Metadata.pm ↑ Summary lib/Module/Install/Admin/Find.pm »
1 package Module::Install::Makefile;
2  
3 46 ▶use strict 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 46 ▶use ExtUtils::MakeMaker ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 46 ▶use Module::Install::Base ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 46 ▶use Fcntl qw/:flock :seek/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 46 ▶use vars qw{$VERSION @ISA $ISCORE};
Subroutine BEGIN: called CC=1 SCAR=0.0
9 46 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
10 46 $VERSION = '1.21';
11 46 @ISA = 'Module::Install::Base';
12 46 $ISCORE = 1;
13 }
14  
15 41 ▶sub Makefile { $_[0] }
Subroutine Makefile: called CC=1 SCAR=0.0
Pod undocumented
16  
17 45 my %seen = ();
18  
19 0 ▶sub prompt {
Subroutine prompt: not called CC=5 SCAR=34.0
Pod undocumented
20 0 shift;
21  
22 # Infinite loop protection
23 0 my @c = caller();
24 0 ▶ if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$seen{"$c[1]|$c[2]|$_[0]"} > 3) 0 0 0
25 0 die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
26 }
27  
28 # In automated testing or non-interactive session, always use defaults
29 0 ▶ if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'AUTOMATED_TESTING'} || -!-t(STDIN) and not $ENV{'PERL_MM_USE_DEFAULT'}) { } 0 0 0
Condition0%0/6
$ENV{"AUTOMATED_TESTING"} || -!-t(STDIN) and not $ENV{"PERL_MM_USE_DEFAULT"}
!ll&&!rl&&r
000
$ENV{"AUTOMATED_TESTING"} or -!-t(STDIN)
l!l&&r!l&&!r
000
MC/DC0%0/3
$ENV{"AUTOMATED_TESTING"} || -!-t(STDIN) and not $ENV{"PERL_MM_USE_DEFAULT"}
$ENV{"AUTOMATED_TESTING"} -!-t(STDIN) not $ENV{"PERL_MM_USE_DEFAULT"}
Truth table0%0/5
A or not(B) and not(C)
A= $ENV{"AUTOMATED_TESTING"}B= -!-t(STDIN)C= not $ENV{"PERL_MM_USE_DEFAULT"}
ABCresult
00X0
1X00
0100
1X11
0111
30 0 local $ENV{PERL_MM_USE_DEFAULT} = 1;
31 0 goto &ExtUtils::MakeMaker::prompt;
32 } else {
33 0 goto &ExtUtils::MakeMaker::prompt;
34 }
35 }
36  
37 # Store a cleaned up version of the MakeMaker version,
38 # since we need to behave differently in a variety of
39 # ways based on the MM version.
40 45 my $makemaker = eval $ExtUtils::MakeMaker::VERSION;
41  
42 # If we are passed a param, do a "newer than" comparison.
43 # Otherwise, just return the MakeMaker version.
44 248 ▶sub makemaker {
Subroutine makemaker: called CC=3 SCAR=14.2
Pod undocumented
45 248 ▶ ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0
Branch: 1 branch
BranchTrueFalseTotal
@_ < 2 || $makemaker >= eval $_[1] ? : 248 0 248
Condition33%1/3
@_ < 2 or $makemaker >= eval $_[1]
l!l&&r!l&&!r
02480
MC/DC0%0/2
@_ < 2 or $makemaker >= eval $_[1]
@_ < 2 $makemaker >= eval $_[1]
Truth table33%1/3
A or B
A= @_ < 2B= $makemaker >= eval $_[1]
ABresult
1X1
011
000
46 }
47  
48 # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified
49 # as we only need to know here whether the attribute is an array
50 # or a hash or something else (which may or may not be appendable).
51 45 my %makemaker_argtype = (
52 C => 'ARRAY',
53 CONFIG => 'ARRAY',
54 # CONFIGURE => 'CODE', # ignore
55 DIR => 'ARRAY',
56 DL_FUNCS => 'HASH',
57 DL_VARS => 'ARRAY',
58 EXCLUDE_EXT => 'ARRAY',
59 EXE_FILES => 'ARRAY',
60 FUNCLIST => 'ARRAY',
61 H => 'ARRAY',
62 IMPORTS => 'HASH',
63 INCLUDE_EXT => 'ARRAY',
64 LIBS => 'ARRAY', # ignore ''
65 MAN1PODS => 'HASH',
66 MAN3PODS => 'HASH',
67 META_ADD => 'HASH',
68 META_MERGE => 'HASH',
69 PL_FILES => 'HASH',
70 PM => 'HASH',
71 PMLIBDIRS => 'ARRAY',
72 PMLIBPARENTDIRS => 'ARRAY',
73 PREREQ_PM => 'HASH',
74 CONFIGURE_REQUIRES => 'HASH',
75 SKIP => 'ARRAY',
76 TYPEMAPS => 'ARRAY',
77 XS => 'HASH',
78 # VERSION => ['version',''], # ignore
79 # _KEEP_AFTER_FLUSH => '',
80  
81 clean => 'HASH',
82 depend => 'HASH',
83 dist => 'HASH',
84 dynamic_lib=> 'HASH',
85 linkext => 'HASH',
86 macro => 'HASH',
87 postamble => 'HASH',
88 realclean => 'HASH',
89 test => 'HASH',
90 tool_autosplit => 'HASH',
91  
92 # special cases where you can use makemaker_append
93 CCFLAGS => 'APPENDABLE',
94 DEFINE => 'APPENDABLE',
95 INC => 'APPENDABLE',
96 LDDLFLAGS => 'APPENDABLE',
97 LDFROM => 'APPENDABLE',
98 );
99  
100 205 ▶sub makemaker_args {
Subroutine makemaker_args: called CC=13 SCAR=32.6
Pod undocumented
101 205 my ($self, %new_args) = @_;
102 205 ▶ my $args = ( $self->{makemaker_args} ||= {} );
Condition100%2/2
$self->{"makemaker_args"} ||= {}
l!l
16243
MC/DC100%1/1
$self->{"makemaker_args"} ||= {}
$self->{"makemaker_args"}
Truth table100%2/2
A
A= $self->{"makemaker_args"}
Aresult
11
00
103 205 foreach my $key (keys %new_args) {
104 37 ▶ if ($makemaker_argtype{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($makemaker_argtype{$key}) { } 7 30 37
105 7 ▶ if ($makemaker_argtype{$key} eq 'ARRAY') {
Branch: 3 branches
BranchTrueFalseTotal
if ($makemaker_argtype{$key} eq 'ARRAY') { } 0 7 7
elsif ($makemaker_argtype{$key} eq 'HASH') { } 3 4 7
elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { } 4 0 4
106 0 ▶ $args->{$key} = [] unless defined $args->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->{$key} 0 0 0
107 0 ▶ unless (ref $args->{$key} eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args->{$key} eq "ARRAY") 0 0 0
108 0 $args->{$key} = [$args->{$key}]
109 }
110 0 ▶ push @{$args->{$key}},
Branch: 1 branch
BranchTrueFalseTotal
ref $new_args{$key} eq 'ARRAY' ? : 0 0 0
111 ref $new_args{$key} eq 'ARRAY'
112 0 ? @{$new_args{$key}}
113 0 : $new_args{$key};
114 }
115 elsif ($makemaker_argtype{$key} eq 'HASH') {
116 3 ▶ $args->{$key} = {} unless defined $args->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->{$key} 3 0 3
117 3 foreach my $skey (keys %{ $new_args{$key} }) {
118 4 $args->{$key}{$skey} = $new_args{$key}{$skey};
119 }
120 }
121 elsif ($makemaker_argtype{$key} eq 'APPENDABLE') {
122 4 $self->makemaker_append($key => $new_args{$key});
123 }
124 }
125 else {
126 30 ▶ if (defined $args->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{$key}) 0 30 30
127 0 warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n};
128 }
129 30 $args->{$key} = $new_args{$key};
130 }
131 }
132 205 return $args;
133 }
134  
135 # For mm args that take multiple space-separated args,
136 # append an argument to the current list.
137 4 ▶sub makemaker_append {
Subroutine makemaker_append: called CC=2 SCAR=6.9
Pod undocumented
138 4 my $self = shift;
139 4 my $name = shift;
140 4 my $args = $self->makemaker_args;
141 $args->{$name} = defined $args->{$name}
142 4 ▶ ? join( ' ', $args->{$name}, @_ )
Branch: 1 branch
BranchTrueFalseTotal
defined $args->{$name} ? : 1 3 4
143 : join( ' ', @_ );
144 }
145  
146 0 ▶sub build_subdirs {
Subroutine build_subdirs: not called CC=3 SCAR=24.8
Pod undocumented
147 0 my $self = shift;
148 0 ▶ my $subdirs = $self->makemaker_args->{DIR} ||= [];
Condition0%0/2
$self->makemaker_args->{"DIR"} ||= []
l!l
00
MC/DC0%0/1
$self->makemaker_args->{"DIR"} ||= []
$self->makemaker_args->{"DIR"}
Truth table0%0/2
A
A= $self->makemaker_args->{"DIR"}
Aresult
11
00
149 0 for my $subdir (@_) {
150 0 push @$subdirs, $subdir;
151 }
152 }
153  
154 39 ▶sub clean_files {
Subroutine clean_files: called CC=3 SCAR=12.0
Pod undocumented
155 39 my $self = shift;
156 39 ▶ my $clean = $self->makemaker_args->{clean} ||= {};
Condition50%1/2
$self->makemaker_args->{"clean"} ||= {}
l!l
039
MC/DC0%0/1
$self->makemaker_args->{"clean"} ||= {}
$self->makemaker_args->{"clean"}
Truth table50%1/2
A
A= $self->makemaker_args->{"clean"}
Aresult
11
00
157 %$clean = (
158 %$clean,
159 39 ▶ FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
Condition33%1/3
$clean->{'FILES'} || ()
l!l&&r!l&&!r
0390
MC/DC0%0/2
$clean->{'FILES'} || ()
$clean->{'FILES'} ()
Truth table33%1/3
A || B
A= $clean->{'FILES'}B= ()
ABresult
1X1
011
000
160 );
161 }
162  
163 42 ▶sub realclean_files {
Subroutine realclean_files: called CC=3 SCAR=11.0
Pod undocumented
164 42 my $self = shift;
165 42 ▶ my $realclean = $self->makemaker_args->{realclean} ||= {};
Condition100%2/2
$self->makemaker_args->{"realclean"} ||= {}
l!l
141
MC/DC100%1/1
$self->makemaker_args->{"realclean"} ||= {}
$self->makemaker_args->{"realclean"}
Truth table100%2/2
A
A= $self->makemaker_args->{"realclean"}
Aresult
11
00
166 %$realclean = (
167 %$realclean,
168 42 ▶ FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
Condition66%2/3
$realclean->{'FILES'} || ()
l!l&&r!l&&!r
1410
MC/DC0%0/2
$realclean->{'FILES'} || ()
$realclean->{'FILES'} ()
Truth table66%2/3
A || B
A= $realclean->{'FILES'}B= ()
ABresult
1X1
011
000
169 );
170 }
171  
172 0 ▶sub libs {
Subroutine libs: not called CC=2 SCAR=17.9
Pod undocumented
173 0 my $self = shift;
174 0 ▶ my $libs = ref $_[0] ? shift : [ shift ];
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
175 0 $self->makemaker_args( LIBS => $libs );
176 }
177  
178 0 ▶sub inc {
Subroutine inc: not called CC=1 SCAR=6.9
Pod undocumented
179 0 my $self = shift;
180 0 $self->makemaker_args( INC => shift );
181 }
182  
183 0 ▶sub _wanted_t {
Subroutine _wanted_t: not called CC=1 SCAR=0.0
184 }
185  
186 0 ▶sub tests_recursive {
Subroutine tests_recursive: not called CC=4 SCAR=30.0
Pod undocumented
187 0 my $self = shift;
188 0 ▶ my $dir = shift || 't';
Condition0%0/2
shift() || 't'
l!l
00
MC/DC0%0/1
shift() || 't'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
189 0 ▶ unless ( -d $dir ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $dir) 0 0 0
190 0 die "tests_recursive dir '$dir' does not exist";
191 }
192 0 ▶ my %tests = map { $_ => 1 } split / /, ($self->tests || '');
Condition0%0/2
$self->tests || ''
l!l
00
MC/DC0%0/1
$self->tests || ''
$self->tests
Truth table0%0/2
A
A= $self->tests
Aresult
11
00
193 0 require File::Find;
194 File::Find::find(
195 0 ▶ sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 },
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
/\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 0 0 0
Condition0%0/3
/\.t$/ and -f $_
!ll&&!rl&&r
000
MC/DC0%0/2
/\.t$/ and -f $_
/\.t$/ -f $_
Truth table0%0/3
A and B
A= /\.t$/B= -f $_
ABresult
0X0
100
111
196 0 $dir
197 );
198 0 $self->tests( join ' ', sort keys %tests );
199 }
200  
201 42 ▶sub write {
Subroutine write: called CC=37 SCAR=44.5
Pod undocumented
202 42 my $self = shift;
203 42 ▶ die "&Makefile->write() takes no arguments\n" if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 42 42
204  
205 # Check the current Perl version
206 42 my $perl_version = $self->perl_version;
207 42 ▶ if ( $perl_version ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($perl_version) 40 2 42
208 40 ▶ eval "use $perl_version; 1"
Subroutine BEGIN: called CC=1 SCAR=0.1
Branch: 1 branch
BranchTrueFalseTotal
eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version" 40 0 40
209 or die "ERROR: perl: Version $] is installed, "
210 . "but we need version >= $perl_version";
211 }
212  
213 # Make sure we have a new enough MakeMaker
214 42 require ExtUtils::MakeMaker;
215  
216 42 ▶ if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($perl_version and $self->_cmp($perl_version, '5.006') >= 0) { } 0 42 42
Condition66%2/3
$perl_version and $self->_cmp($perl_version, "5.006") >= 0
!ll&&!rl&&r
2400
MC/DC0%0/2
$perl_version and $self->_cmp($perl_version, "5.006") >= 0
$perl_version $self->_cmp($perl_version, "5.006") >= 0
Truth table66%2/3
A and B
A= $perl_versionB= $self->_cmp($perl_version, "5.006") >= 0
ABresult
0X0
100
111
217 # This previous attempted to inherit the version of
218 # ExtUtils::MakeMaker in use by the module author, but this
219 # was found to be untenable as some authors build releases
220 # using future dev versions of EU:MM that nobody else has.
221 # Instead, #toolchain suggests we use 6.59 which is the most
222 # stable version on CPAN at time of writing and is, to quote
223 # ribasushi, "not terminally fucked, > and tested enough".
224 # TODO: We will now need to maintain this over time to push
225 # the version up as new versions are released.
226 0 $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 );
227 0 $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
228 } else {
229 # Allow legacy-compatibility with 5.005 by depending on the
230 # most recent EU:MM that supported 5.005.
231 42 $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 );
232 42 $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
233 }
234  
235 # Generate the MakeMaker params
236 42 my $args = $self->makemaker_args;
237 42 $args->{DISTNAME} = $self->name;
238 42 ▶ $args->{NAME} = $self->module_name || $self->name;
Condition33%1/3
$self->module_name || $self->name
l!l&&r!l&&!r
0420
MC/DC0%0/2
$self->module_name || $self->name
$self->module_name $self->name
Truth table33%1/3
A || B
A= $self->module_nameB= $self->name
ABresult
1X1
011
000
239 42 $args->{NAME} =~ s/-/::/g;
240 42 ▶ $args->{VERSION} = $self->version or die <<'EOT';
Branch: 1 branch
BranchTrueFalseTotal
$args->{"VERSION"} = $self->version or die "ERROR: Can't determine distribution version. Please specify it\nexplicitly via 'version' in Makefile.PL, or set a valid \$VERSION\nin a module, and provide its file path via 'version_from' (or\n'all_from' if you prefer) in Makefile.PL.\n" 42 0 42
241 ERROR: Can't determine distribution version. Please specify it
242 explicitly via 'version' in Makefile.PL, or set a valid $VERSION
243 in a module, and provide its file path via 'version_from' (or
244 'all_from' if you prefer) in Makefile.PL.
245 EOT
246  
247 42 ▶ if ( $self->tests ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->tests) { } 0 42 42
elsif ($Module::Install::ExtraTests::use_extratests) { } 0 42 42
elsif (-d 'xt' and $Module::Install::AUTHOR || $ENV{'RELEASE_TESTING'}) { } 2 80 82
248 0 my @tests = split ' ', $self->tests;
249 0 my %seen;
250 $args->{test} = {
251 0 TESTS => (join ' ', grep {!$seen{$_}++} @tests),
252 };
253 } elsif ( $Module::Install::ExtraTests::use_extratests ) {
254 # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness.
255 # So, just ignore our xt tests here.
256 ▶ } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) {
Condition50%3/6
-d "xt" and $Module::Install::AUTHOR || $ENV{"RELEASE_TESTING"}
!ll&&!rl&&r
4002
$Module::Install::AUTHOR or $ENV{"RELEASE_TESTING"}
l!l&&r!l&&!r
200
MC/DC33%1/3
-d "xt" and $Module::Install::AUTHOR || $ENV{"RELEASE_TESTING"}
-d "xt" $Module::Install::AUTHOR $ENV{"RELEASE_TESTING"}
Truth table50%2/4
A and B or C
A= -d "xt"B= $Module::Install::AUTHORC= $ENV{"RELEASE_TESTING"}
ABCresult
0XX0
1000
11X1
1011
257 $args->{test} = {
258 2 TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ),
259 };
260 }
261 42 ▶ if ( $] >= 5.005 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.005") 42 0 42
262 42 $args->{ABSTRACT} = $self->abstract;
263 42 ▶ $args->{AUTHOR} = join ', ', @{$self->author || []};
Condition100%2/2
$self->author || []
l!l
357
MC/DC100%1/1
$self->author || []
$self->author
Truth table100%2/2
A
A= $self->author
Aresult
11
00
264 }
265 42 ▶ if ( $self->makemaker(6.10) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->makemaker("6.1")) 42 0 42
266 42 $args->{NO_META} = 1;
267 #$args->{NO_MYMETA} = 1;
268 }
269 42 ▶ if ( $self->makemaker(6.17) and $self->sign ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->makemaker("6.17") and $self->sign) 1 41 42
Condition66%2/3
$self->makemaker("6.17") and $self->sign
!ll&&!rl&&r
0411
MC/DC50%1/2
$self->makemaker("6.17") and $self->sign
$self->makemaker("6.17") $self->sign
Truth table66%2/3
A and B
A= $self->makemaker("6.17")B= $self->sign
ABresult
0X0
100
111
270 1 $args->{SIGN} = 1;
271 }
272 42 ▶ unless ( $self->is_admin ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->is_admin) 0 42 42
273 0 delete $args->{SIGN};
274 }
275 42 ▶ if ( $self->makemaker(6.31) and $self->license ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->makemaker("6.31") and $self->license) 42 0 42
Condition33%1/3
$self->makemaker("6.31") and $self->license
!ll&&!rl&&r
0042
MC/DC0%0/2
$self->makemaker("6.31") and $self->license
$self->makemaker("6.31") $self->license
Truth table33%1/3
A and B
A= $self->makemaker("6.31")B= $self->license
ABresult
0X0
100
111
276 42 $args->{LICENSE} = $self->license;
277 }
278  
279 42 ▶ my $prereq = ($args->{PREREQ_PM} ||= {});
Condition50%1/2
$args->{"PREREQ_PM"} ||= {}
l!l
042
MC/DC0%0/1
$args->{"PREREQ_PM"} ||= {}
$args->{"PREREQ_PM"}
Truth table50%1/2
A
A= $args->{"PREREQ_PM"}
Aresult
11
00
280 %$prereq = ( %$prereq,
281 12 map { @$_ } # flatten [module => version]
282 42 map { @$_ }
283 grep $_,
284 ($self->requires)
285 );
286  
287 # Remove any reference to perl, PREREQ_PM doesn't support it
288 42 delete $args->{PREREQ_PM}->{perl};
289  
290 # Merge both kinds of requires into BUILD_REQUIRES
291 42 ▶ my $build_prereq = ($args->{BUILD_REQUIRES} ||= {});
Condition50%1/2
$args->{"BUILD_REQUIRES"} ||= {}
l!l
042
MC/DC0%0/1
$args->{"BUILD_REQUIRES"} ||= {}
$args->{"BUILD_REQUIRES"}
Truth table50%1/2
A
A= $args->{"BUILD_REQUIRES"}
Aresult
11
00
292 %$build_prereq = ( %$build_prereq,
293 91 map { @$_ } # flatten [module => version]
294 42 map { @$_ }
295 grep $_,
296 ($self->configure_requires, $self->build_requires)
297 );
298  
299 # Remove any reference to perl, BUILD_REQUIRES doesn't support it
300 42 delete $args->{BUILD_REQUIRES}->{perl};
301  
302 # Delete bundled dists from prereq_pm, add it to Makefile DIR
303 42 ▶ my $subdirs = ($args->{DIR} || []);
Condition50%1/2
$args->{'DIR'} || []
l!l
042
MC/DC0%0/1
$args->{'DIR'} || []
$args->{'DIR'}
Truth table50%1/2
A
A= $args->{'DIR'}
Aresult
11
00
304 42 ▶ if ($self->bundles) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->bundles) 0 42 42
305 0 my %processed;
306 0 foreach my $bundle (@{ $self->bundles }) {
307 0 my ($mod_name, $dist_dir) = @$bundle;
308 0 delete $prereq->{$mod_name};
309 0 $dist_dir = File::Basename::basename($dist_dir); # dir for building this module
310 0 ▶ if (not exists $processed{$dist_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $processed{$dist_dir}) 0 0 0
311 0 ▶ if (-d $dist_dir) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $dist_dir) 0 0 0
312 # List as sub-directory to be processed by make
313 0 push @$subdirs, $dist_dir;
314 }
315 # Else do nothing: the module is already present on the system
316 0 $processed{$dist_dir} = undef;
317 }
318 }
319 }
320  
321 42 ▶ unless ( $self->makemaker('6.55_03') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->makemaker("6.55_03")) 0 42 42
322 0 %$prereq = (%$prereq,%$build_prereq);
323 0 delete $args->{BUILD_REQUIRES};
324 }
325  
326 42 ▶ if ( my $perl_version = $self->perl_version ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $perl_version = $self->perl_version) 40 2 42
327 40 ▶ eval "use $perl_version; 1"
Subroutine BEGIN: called CC=1 SCAR=0.1
Branch: 1 branch
BranchTrueFalseTotal
eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version" 40 0 40
328 or die "ERROR: perl: Version $] is installed, "
329 . "but we need version >= $perl_version";
330  
331 40 ▶ if ( $self->makemaker(6.48) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->makemaker("6.48")) 40 0 40
332 40 $args->{MIN_PERL_VERSION} = $perl_version;
333 }
334 }
335  
336 42 ▶ if ($self->installdirs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->installdirs) 3 39 42
337 3 ▶ warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"INSTALLDIRS"} 1 2 3
338 3 $args->{INSTALLDIRS} = $self->installdirs;
339 }
340  
341 my %args = map {
342 42 ( $_ => $args->{$_} ) } grep {defined($args->{$_} )
343 } keys %$args;
344  
345 42 my $user_preop = delete $args{dist}->{PREOP};
346 42 ▶ if ( my $preop = $self->admin->preop($user_preop) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $preop = $self->admin->preop($user_preop)) 42 0 42
347 42 foreach my $key ( keys %$preop ) {
348 42 $args{dist}->{$key} = $preop->{$key};
349 }
350 }
351  
352 42 my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
353 39 ▶ $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
Condition50%1/2
$mm->{'FIRST_MAKEFILE'} || 'Makefile'
l!l
390
MC/DC0%0/1
$mm->{'FIRST_MAKEFILE'} || 'Makefile'
$mm->{'FIRST_MAKEFILE'}
Truth table50%1/2
A
A= $mm->{'FIRST_MAKEFILE'}
Aresult
11
00
354 }
355  
356 39 ▶sub fix_up_makefile {
Subroutine fix_up_makefile: called CC=8 SCAR=21.2
Pod undocumented
357 39 my $self = shift;
358 39 my $makefile_name = shift;
359 39 ▶ my $top_class = ref($self->_top) || '';
Condition50%1/2
ref $self->_top || ''
l!l
390
MC/DC0%0/1
ref $self->_top || ''
ref $self->_top
Truth table50%1/2
A
A= ref $self->_top
Aresult
11
00
360 39 ▶ my $top_version = $self->_top->VERSION || '';
Condition50%1/2
$self->_top->VERSION || ''
l!l
390
MC/DC0%0/1
$self->_top->VERSION || ''
$self->_top->VERSION
Truth table50%1/2
A
A= $self->_top->VERSION
Aresult
11
00
361  
362 39 ▶ my $preamble = $self->preamble
Branch: 1 branch
BranchTrueFalseTotal
$self->preamble ? : 0 39 39
363 ? "# Preamble by $top_class $top_version\n"
364 . $self->preamble
365 : '';
366 39 ▶ my $postamble = "# Postamble by $top_class $top_version\n"
Condition50%1/2
$self->postamble || ''
l!l
390
MC/DC0%0/1
$self->postamble || ''
$self->postamble
Truth table50%1/2
A
A= $self->postamble
Aresult
11
00
367 . ($self->postamble || '');
368  
369 39 local *MAKEFILE;
370 39 ▶ open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
Branch: 1 branch
BranchTrueFalseTotal
open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open ${makefile_name}: $!" 39 0 39
371 39 eval { flock MAKEFILE, LOCK_EX };
372 39 my $makefile = do { local $/; <MAKEFILE> };
373  
374 39 $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
375 39 $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
376 39 $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
377 39 $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
378 39 $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
379  
380 # Module::Install will never be used to build the Core Perl
381 # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
382 # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
383 39 $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
384 #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
385  
386 # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
387 39 $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g;
388  
389 # XXX - This is currently unused; not sure if it breaks other MM-users
390 # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
391  
392 39 seek MAKEFILE, 0, SEEK_SET;
393 39 truncate MAKEFILE, 0;
394 39 ▶ print MAKEFILE "$preamble$makefile$postamble" or die $!;
Branch: 1 branch
BranchTrueFalseTotal
print MAKEFILE "$preamble$makefile$postamble" or die $! 39 0 39
395 39 ▶ close MAKEFILE or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close MAKEFILE or die $! 39 0 39
396  
397 39 1;
398 }
399  
400 39 ▶sub preamble {
Subroutine preamble: called CC=2 SCAR=7.1
Pod undocumented
401 39 my ($self, $text) = @_;
402 39 ▶ $self->{preamble} = $text . $self->{preamble} if defined $text;
Branch: 1 branch
BranchTrueFalseTotal
if defined $text 0 39 39
403 39 $self->{preamble};
404 }
405  
406 43 ▶sub postamble {
Subroutine postamble: called CC=3 SCAR=11.0
Pod undocumented
407 44 my ($self, $text) = @_;
408 44 ▶ $self->{postamble} ||= $self->admin->postamble;
Condition66%2/3
$self->{"postamble"} ||= $self->admin->postamble
l!l&&r!l&&!r
4390
MC/DC0%0/2
$self->{"postamble"} ||= $self->admin->postamble
$self->{"postamble"} $self->admin->postamble
Truth table66%2/3
A ||= B
A= $self->{"postamble"}B= $self->admin->postamble
ABresult
1X1
011
000
409 44 ▶ $self->{postamble} .= $text if defined $text;
Branch: 1 branch
BranchTrueFalseTotal
if defined $text 4 39 43
410 $self->{postamble}
411 44 }
412  
413 45 1;
414  
415 __END__
« lib/Module/Install/Admin/Metadata.pm ↑ Summary lib/Module/Install/Admin/Find.pm »