lib/ExtUtils/MakeMaker.pm

filter: Statementstmt 90.8% 584 / 643 Branchbran 71.4% 243 / 340 Conditioncond 54.8% 85 / 155 MC/DCmcdc 27.9% 26 / 93 Subroutinesub 93.8% 46 / 49 Podpod 20.0% 4 / 20 totaltotal 76.0% 988 / 1300 CC 254 SCAR 42.1
CC
254
Cov
80%
new
161.5
parse_args
124.1
skipcheck
19.3
CRAP 67.6
« lib/ExtUtils/MM_Unix.pm ↑ Summary lib/ExtUtils/Command/MM.pm »
1 # $Id$
2 package ExtUtils::MakeMaker;
3  
4 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 96 ▶BEGIN {require 5.006;}
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 96 require Exporter;
10 96 ▶use ExtUtils::MakeMaker::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 96 ▶use ExtUtils::MakeMaker::version; # ensure we always have our fake version.pm
Subroutine BEGIN: called CC=1 SCAR=0.0
12 96 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 96 ▶use File::Path;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 96 my $CAN_DECODE = eval { require ExtUtils::MakeMaker::Locale; }; # 2 birds, 1 stone
15 96 ▶eval { ExtUtils::MakeMaker::Locale::reinit('UTF-8') }
Branch: 1 branch
BranchTrueFalseTotal
if $CAN_DECODE and &Encode::find_encoding("locale")->name eq "ascii" 96 0 96
Condition33%1/3
$CAN_DECODE and &Encode::find_encoding("locale")->name eq "ascii"
!ll&&!rl&&r
0096
MC/DC0%0/2
$CAN_DECODE and &Encode::find_encoding("locale")->name eq "ascii"
$CAN_DECODE &Encode::find_encoding("locale")->name eq "ascii"
Truth table33%1/3
A and B
A= $CAN_DECODEB= &Encode::find_encoding("locale")->name eq "ascii"
ABresult
0X0
100
111
16 if $CAN_DECODE and Encode::find_encoding('locale')->name eq 'ascii';
17  
18 96 our $Verbose = 0; # exported
19 96 our @Parent; # needs to be localized
20 96 our @Get_from_Config; # referenced by MM_Unix
21 96 our @MM_Sections;
22 96 our @Overridable;
23 96 my @Prepend_parent;
24 96 our %Recognized_Att_Keys;
25 96 our %macro_fsentity; # whether a macro is a filesystem name
26 96 our %macro_dep; # whether a macro is a dependency
27  
28 96 our $VERSION = '7.78';
29 96 $VERSION =~ tr/_//d;
30  
31 # Emulate something resembling CVS $Revision$
32 96 (our $Revision = $VERSION) =~ s{_}{};
33 96 $Revision = int $Revision * 10000;
34  
35 96 our $Filename = __FILE__; # referenced outside MakeMaker
36  
37 96 our @ISA = qw(Exporter);
38 96 our @EXPORT = qw(&WriteMakefile $Verbose &prompt &os_unsupported);
39 96 our @EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists
40 &WriteEmptyMakefile &open_for_writing &write_file_via_tmp
41 &_sprintf562);
42  
43 # These will go away once the last of the Win32 & VMS specific code is
44 # purged.
45 96 my $Is_VMS = $^O eq 'VMS';
46 96 my $Is_Win32 = $^O eq 'MSWin32';
47 96 our $UNDER_CORE = $ENV{PERL_CORE}; # needs to be our
48  
49 96 full_setup();
50  
51 96 require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker
52 # will give them MM.
53  
54 96 require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect
55 # loading ExtUtils::MakeMaker will give them MY.
56 # This will go when Embed is its own CPAN module.
57  
58  
59 # 5.6.2 can't do sprintf "%1$s" - this can only do %s
60 322 ▶sub _sprintf562 {
Subroutine _sprintf562: called CC=2 SCAR=6.9
61 322 my ($format, @args) = @_;
62 322 ▶ for (my $i = 1; $i <= @args; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= @args) 588 322 910
63 588 $format =~ s#%$i\$s#$args[$i-1]#g;
64 }
65 322 $format;
66 }
67  
68 225 ▶sub WriteMakefile {
Subroutine WriteMakefile: called CC=2 SCAR=7.0
Pod undocumented
69 225 ▶ croak "WriteMakefile: Need even number of args" if @_ % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @_ % 2 0 225 225
70  
71 225 require ExtUtils::MY;
72 225 my %att = @_;
73  
74 225 _convert_compat_attrs(\%att);
75  
76 225 _verify_att(\%att);
77  
78 225 my $mm = MM->new(\%att);
79 214 $mm->flush;
80  
81 214 return $mm;
82 }
83  
84  
85 # Basic signatures of the attributes WriteMakefile takes. Each is the
86 # reference type. Empty value indicate it takes a non-reference
87 # scalar.
88 96 my %Att_Sigs;
89 96 my %Special_Sigs = (
90 AUTHOR => 'ARRAY',
91 C => 'ARRAY',
92 CONFIG => 'ARRAY',
93 CONFIGURE => 'CODE',
94 DIR => 'ARRAY',
95 DL_FUNCS => 'HASH',
96 DL_VARS => 'ARRAY',
97 EXCLUDE_EXT => 'ARRAY',
98 EXE_FILES => 'ARRAY',
99 FUNCLIST => 'ARRAY',
100 H => 'ARRAY',
101 IMPORTS => 'HASH',
102 INCLUDE_EXT => 'ARRAY',
103 LIBS => ['ARRAY',''],
104 MAN1PODS => 'HASH',
105 MAN3PODS => 'HASH',
106 META_ADD => 'HASH',
107 META_MERGE => 'HASH',
108 OBJECT => ['ARRAY', ''],
109 PL_FILES => 'HASH',
110 PM => 'HASH',
111 PMLIBDIRS => 'ARRAY',
112 PMLIBPARENTDIRS => 'ARRAY',
113 PREREQ_PM => 'HASH',
114 BUILD_REQUIRES => 'HASH',
115 CONFIGURE_REQUIRES => 'HASH',
116 TEST_REQUIRES => 'HASH',
117 SKIP => 'ARRAY',
118 TYPEMAPS => 'ARRAY',
119 XS => 'HASH',
120 XSBUILD => 'HASH',
121 VERSION => ['version',''],
122 _KEEP_AFTER_FLUSH => '',
123  
124 clean => 'HASH',
125 depend => 'HASH',
126 dist => 'HASH',
127 dynamic_lib=> 'HASH',
128 linkext => 'HASH',
129 macro => 'HASH',
130 postamble => 'HASH',
131 realclean => 'HASH',
132 test => 'HASH',
133 tool_autosplit => 'HASH',
134 );
135  
136 96 @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys;
137 96 @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs;
138  
139 454 ▶sub _convert_compat_attrs { #result of running several times should be same
Subroutine _convert_compat_attrs: called CC=4 SCAR=14.0
140 454 my($att) = @_;
141 454 ▶ if (exists $att->{AUTHOR}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $att->{"AUTHOR"}) 57 397 454
142 57 ▶ if ($att->{AUTHOR}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($att->{'AUTHOR'}) { } 57 0 57
143 57 ▶ if (!ref($att->{AUTHOR})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $att->{"AUTHOR"}) 25 32 57
144 25 my $t = $att->{AUTHOR};
145 25 $att->{AUTHOR} = [$t];
146 }
147 } else {
148 0 $att->{AUTHOR} = [];
149 }
150 }
151 }
152  
153 225 ▶sub _verify_att {
Subroutine _verify_att: called CC=5 SCAR=16.1
154 225 my($att) = @_;
155  
156 225 foreach my $key (sort keys %$att) {
157 767 my $val = $att->{$key};
158 767 my $sig = $Att_Sigs{$key};
159 767 ▶ unless( defined $sig ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sig) 2 765 767
160 2 warn "WARNING: $key is not a known parameter.\n";
161 2 next;
162 }
163  
164 765 ▶ my @sigs = ref $sig ? @$sig : $sig;
Branch: 1 branch
BranchTrueFalseTotal
ref $sig ? : 30 735 765
165 765 my $given = ref $val;
166 765 ▶ unless( grep { _is_of_type($val, $_) } @sigs ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {_is_of_type($val, $_);} @sigs) 5 760 765
167 5 my $takes = join " or ", map { _format_att($_) } @sigs;
168  
169 5 my $has = _format_att($given);
170 5 warn "WARNING: $key takes a $takes not a $has.\n".
171 " Please inform the author.\n";
172 }
173 }
174 }
175  
176  
177 # Check if a given thing is a reference or instance of $type
178 805 ▶sub _is_of_type {
Subroutine _is_of_type: called CC=3 SCAR=11.0
179 805 my($thing, $type) = @_;
180  
181 805 ▶ return 1 if ref $thing eq $type;
Branch: 1 branch
BranchTrueFalseTotal
if ref $thing eq $type 763 42 805
182  
183 42 local $SIG{__DIE__};
184 42 ▶ return 1 if eval{ $thing->isa($type) };
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { $thing->isa($type) } } 1 41 42
185  
186 41 return 0;
187 }
188  
189  
190 13 ▶sub _format_att {
Subroutine _format_att: called CC=3 SCAR=11.0
191 13 my $given = shift;
192  
193 13 ▶ return $given eq '' ? "string/number"
Branch: 2 branches
BranchTrueFalseTotal
$given eq '' ? : 4 9 13
uc $given eq $given ? : 6 3 9
194 : uc $given eq $given ? "$given reference"
195 : "$given object"
196 ;
197 }
198  
199  
200 5 ▶sub prompt ($;$) { ## no critic
Subroutine prompt: called CC=13 SCAR=28.8
Pod documented
201 5 my($mess, $def) = @_;
202 5 ▶ confess("prompt function called without an argument")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mess 1 4 5
203 unless defined $mess;
204  
205 4 ▶ my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ;
Condition11%1/9
-t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT))
!ll&&!rl&&r
400
-t STDOUT or not -f STDOUT || -c STDOUT
l!l&&r!l&&!r
000
-f STDOUT || -c STDOUT
l!l&&r!l&&!r
000
MC/DC0%0/4
-t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT))
-t STDIN -t STDOUT -f STDOUT -c STDOUT
Truth table20%1/5
A && B or not(C || D)
A= -t STDINB= -t STDOUTC= -f STDOUTD= -c STDOUT
ABCDresult
0XXX0
101X0
10010
11XX1
10001
206  
207 4 ▶ my $dispdef = defined $def ? "[$def] " : " ";
Branch: 1 branch
BranchTrueFalseTotal
defined $def ? : 2 2 4
208 4 ▶ $def = defined $def ? $def : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $def ? : 2 2 4
209  
210 4 local $|=1;
211 4 local $\;
212 4 print "$mess $dispdef";
213  
214 4 my $ans;
215 4 ▶ if ($ENV{PERL_MM_USE_DEFAULT} || (!$isa_tty && eof STDIN)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'PERL_MM_USE_DEFAULT'} or not $isa_tty and eof STDIN) { } 3 1 4
Condition50%3/6
$ENV{"PERL_MM_USE_DEFAULT"} or not $isa_tty and eof STDIN
l!l&&r!l&&!r
301
not $isa_tty and eof STDIN
!ll&&!rl&&r
010
MC/DC33%1/3
$ENV{"PERL_MM_USE_DEFAULT"} or not $isa_tty and eof STDIN
$ENV{"PERL_MM_USE_DEFAULT"} not $isa_tty eof STDIN
Truth table50%2/4
A or not(B) and C
A= $ENV{"PERL_MM_USE_DEFAULT"}B= not $isa_ttyC= eof STDIN
ABCresult
1XX1
0111
00X0
0100
216 3 print "$def\n";
217 }
218 else {
219 1 $ans = <STDIN>;
220 1 ▶ if( defined $ans ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ans) { } 1 0 1
221 1 $ans =~ s{\015?\012$}{};
222 }
223 else { # user hit ctrl-D
224 0 print "\n";
225 }
226 }
227  
228 4 ▶ return (!defined $ans || $ans eq '') ? $def : $ans;
Branch: 1 branch
BranchTrueFalseTotal
!defined($ans) || $ans eq '' ? : 3 1 4
Condition66%2/3
not defined $ans or $ans eq ""
l!l&&r!l&&!r
301
MC/DC50%1/2
not defined $ans or $ans eq ""
not defined $ans $ans eq ""
Truth table66%2/3
not(A) or B
A= not defined $ansB= $ans eq ""
ABresult
1X1
011
000
229 }
230  
231 1 ▶sub os_unsupported {
Subroutine os_unsupported: called CC=1 SCAR=0.0
Pod documented
232 1 die "OS unsupported\n";
233 }
234  
235 81 ▶sub eval_in_subdirs {
Subroutine eval_in_subdirs: called CC=7 SCAR=19.5
Pod undocumented
236 81 my($self) = @_;
237 96 ▶ use Cwd qw(cwd abs_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
238 81 ▶ my $pwd = cwd() || die "Can't figure out your cwd!";
Condition50%1/2
cwd() || die(q[Can't figure out your cwd!])
l!l
810
MC/DC0%0/1
cwd() || die(q[Can't figure out your cwd!])
cwd()
Truth table50%1/2
A
A= cwd()
Aresult
11
00
239  
240 81 ▶ local @INC = map eval {abs_path($_) if -e} || $_, @INC;
Branch: 1 branch
BranchTrueFalseTotal
if -e $_ 703 212 915
Condition66%2/3
eval { do { abs_path($_) if -e $_ } } || $_
l!l&&r!l&&!r
7032120
MC/DC0%0/2
eval { do { abs_path($_) if -e $_ } } || $_
eval { do { abs_path($_) if -e $_ } } $_
Truth table66%2/3
A || B
A= eval { do { abs_path($_) if -e $_ } }B= $_
ABresult
1X1
011
000
241 81 push @INC, '.'; # '.' has to always be at the end of @INC
242  
243 81 foreach my $dir (@{$self->{DIR}}){
244 81 my($abs) = $self->catdir($pwd,$dir);
245 81 eval { $self->eval_in_x($abs); };
246 81 ▶ last if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 1 80 81
247 }
248 81 chdir $pwd;
249 81 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 1 80 81
250 }
251  
252 81 ▶sub eval_in_x {
Subroutine eval_in_x: called CC=3 SCAR=11.0
Pod undocumented
253 81 my($self,$dir) = @_;
254 81 ▶ chdir $dir or carp("Couldn't change to directory $dir: $!");
Branch: 1 branch
BranchTrueFalseTotal
chdir $dir or carp("Couldn't change to directory ${dir}: $!") 81 0 81
255  
256 {
257 81 package main;
258 81 do './Makefile.PL';
259 };
260 81 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 80 81
261 # if ($@ =~ /prerequisites/) {
262 # die "MakeMaker WARNING: $@";
263 # } else {
264 # warn "WARNING from evaluation of $dir/Makefile.PL: $@";
265 # }
266 1 die "ERROR from evaluation of $dir/Makefile.PL: $@";
267 }
268 }
269  
270  
271 # package name for the classes into which the first object will be blessed
272 96 my $PACKNAME = 'PACK000';
273  
274 96 ▶sub full_setup {
Subroutine full_setup: called CC=6 SCAR=18.0
Pod undocumented
275 96 ▶ $Verbose ||= 0;
Condition50%1/2
$ExtUtils::MakeMaker::Verbose ||= 0
l!l
096
MC/DC0%0/1
$ExtUtils::MakeMaker::Verbose ||= 0
$ExtUtils::MakeMaker::Verbose
Truth table50%1/2
A
A= $ExtUtils::MakeMaker::Verbose
Aresult
11
00
276  
277 96 my @dep_macros = qw/
278 PERL_INCDEP PERL_ARCHLIBDEP PERL_ARCHIVEDEP
279 /;
280  
281 96 my @fs_macros = qw/
282 FULLPERL XSUBPPDIR
283  
284 INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB INST_MAN1DIR INST_MAN3DIR
285 INSTALLDIRS
286 DESTDIR PREFIX INSTALL_BASE
287 PERLPREFIX SITEPREFIX VENDORPREFIX
288 INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
289 INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
290 INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN
291 INSTALLMAN1DIR INSTALLMAN3DIR
292 INSTALLSITEMAN1DIR INSTALLSITEMAN3DIR
293 INSTALLVENDORMAN1DIR INSTALLVENDORMAN3DIR
294 INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT
295 PERL_LIB PERL_ARCHLIB
296 SITELIBEXP SITEARCHEXP
297  
298 MAKE LIBPERL_A LIB PERL_SRC PERL_INC
299 PPM_INSTALL_EXEC PPM_UNINSTALL_EXEC
300 PPM_INSTALL_SCRIPT PPM_UNINSTALL_SCRIPT
301 /;
302  
303 96 my @attrib_help = qw/
304  
305 AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION
306 C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DISTVNAME
307 DL_FUNCS DL_VARS
308 EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE
309 FULLPERLRUN FULLPERLRUNINST
310 FUNCLIST H IMPORTS
311  
312 INC INCLUDE_EXT LDFROM LIBS LICENSE
313 LINKTYPE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET
314 META_ADD META_MERGE MIN_PERL_VERSION BUILD_REQUIRES CONFIGURE_REQUIRES
315 MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NO_MYMETA NO_PACKLIST NO_PERLLOCAL
316 NORECURS NO_VC OBJECT OPTIMIZE PERL_MALLOC_OK PERL PERLMAINCC PERLRUN
317 PERLRUNINST PERL_CORE
318 PERM_DIR PERM_RW PERM_RWX MAGICXS
319 PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE
320 PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ PUREPERL_ONLY
321 SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST VERSION VERSION_FROM XS
322 XSBUILD XSMULTI XSOPT XSPROTOARG XS_VERSION
323 clean depend dist dynamic_lib linkext macro realclean tool_autosplit
324  
325 MAN1EXT MAN3EXT
326  
327 MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC
328 MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED
329 /;
330 96 push @attrib_help, @fs_macros;
331 96 @macro_fsentity{@fs_macros, @dep_macros} = (1) x (@fs_macros+@dep_macros);
332 96 @macro_dep{@dep_macros} = (1) x @dep_macros;
333  
334 # IMPORTS is used under OS/2 and Win32
335  
336 # @Overridable is close to @MM_Sections but not identical. The
337 # order is important. Many subroutines declare macros. These
338 # depend on each other. Let's try to collect the macros up front,
339 # then pasthru, then the rules.
340  
341 # MM_Sections are the sections we have to call explicitly
342 # in Overridable we have subroutines that are used indirectly
343  
344  
345 96 @MM_Sections =
346 qw(
347  
348 post_initialize const_config constants platform_constants
349 tool_autosplit tool_xsubpp tools_other
350  
351 makemakerdflt
352  
353 dist macro depend cflags const_loadlibs const_cccmd
354 post_constants
355  
356 pasthru
357  
358 special_targets
359 c_o xs_c xs_o
360 top_targets blibdirs linkext dlsyms dynamic_bs dynamic
361 dynamic_lib static static_lib manifypods processPL
362 installbin subdirs
363 clean_subdirs clean realclean_subdirs realclean
364 metafile signature
365 dist_basics dist_core distdir dist_test dist_ci distmeta distsignature
366 install force perldepend makefile staticmake test ppd
367  
368 ); # loses section ordering
369  
370 96 @Overridable = @MM_Sections;
371 96 push @Overridable, qw[
372  
373 libscan makeaperl needs_linking
374 subdir_x test_via_harness test_via_script
375  
376 init_VERSION init_dist init_INST init_INSTALL init_DEST init_dirscan
377 init_PM init_MANPODS init_xs init_PERL init_DIRFILESEP init_linker
378 ];
379  
380 96 push @MM_Sections, qw[
381  
382 pm_to_blib selfdocument
383  
384 ];
385  
386 # Postamble needs to be the last that was always the case
387 96 push @MM_Sections, "postamble";
388 96 push @Overridable, "postamble";
389  
390 # All sections are valid keys.
391 96 @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections;
392  
393 # we will use all these variables in the Makefile
394 96 @Get_from_Config =
395 qw(
396 ar cc cccdlflags ccdlflags cpprun dlext dlsrc exe_ext full_ar ld
397 lddlflags ldflags libc lib_ext obj_ext osname osvers ranlib
398 sitelibexp sitearchexp so
399 );
400  
401 # 5.5.3 doesn't have any concept of vendor libs
402 96 ▶ push @Get_from_Config, qw( vendorarchexp vendorlibexp ) if "$]" >= 5.006;
Branch: 1 branch
BranchTrueFalseTotal
if "$]" >= "5.006" 96 0 96
403  
404 96 foreach my $item (@attrib_help){
405 14496 $Recognized_Att_Keys{$item} = 1;
406 }
407 96 foreach my $item (@Get_from_Config) {
408 2208 $Recognized_Att_Keys{uc $item} = $Config{$item};
409 2208 ▶ print "Attribute '\U$item\E' => '$Config{$item}'\n"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose >= 2 0 2208 2208
410 if ($Verbose >= 2);
411 }
412  
413 #
414 # When we eval a Makefile.PL in a subdirectory, that one will ask
415 # us (the parent) for the values and will prepend "..", so that
416 # all files to be installed end up below OUR ./blib
417 #
418 96 @Prepend_parent = qw(
419 INST_BIN INST_LIB INST_ARCHLIB INST_SCRIPT
420 MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC
421 PERL FULLPERL
422 );
423 }
424  
425 1136 ▶sub _has_cpan_meta_requirements {
Subroutine _has_cpan_meta_requirements: called CC=1 SCAR=0.0
426 1136 return eval {
427 1136 require CPAN::Meta::Requirements;
428 1066 CPAN::Meta::Requirements->VERSION(2.130);
429 # Make sure vstrings can be handled. Some versions of CMR require B to
430 # do this, which won't be available in miniperl.
431 1066 CPAN::Meta::Requirements->new->add_string_requirement('Module' => v1.2);
432 1066 1;
433 };
434 }
435  
436 228 ▶sub new {
Subroutine new: called CC=98 SCAR=50.8
Pod documented
437 228 my($class,$self) = @_;
438 228 my($key);
439  
440 228 ▶ _convert_compat_attrs($self) if defined $self && $self;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self and $self 228 0 228
Condition33%1/3
defined $self and $self
!ll&&!rl&&r
00228
MC/DC0%0/2
defined $self and $self
defined $self $self
Truth table33%1/3
A and B
A= defined $selfB= $self
ABresult
0X0
100
111
441  
442 # Store the original args passed to WriteMakefile()
443 228 foreach my $k (keys %$self) {
444 774 $self->{ARGS}{$k} = $self->{$k};
445 }
446  
447 228 ▶ $self = {} unless defined $self;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self 0 228 228
448  
449 # Temporarily bless it into MM so it can be used as an
450 # object. It will be blessed into a temp package later.
451 228 bless $self, "MM";
452  
453 # Cleanup all the module requirement bits
454 228 my %key2cmr;
455 228 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
456 912 ▶ $self->{$key} ||= {};
Condition100%2/2
$self->{$key} ||= {}
l!l
86826
MC/DC100%1/1
$self->{$key} ||= {}
$self->{$key}
Truth table100%2/2
A
A= $self->{$key}
Aresult
11
00
457 912 ▶ if (_has_cpan_meta_requirements) {
Branch: 1 branch
BranchTrueFalseTotal
if (_has_cpan_meta_requirements()) { } 856 56 912
458 my $cmr = CPAN::Meta::Requirements->from_string_hash(
459 $self->{$key},
460 {
461 3 ▶ bad_version_hook => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
462 #no warnings 'numeric'; # module doesn't use warnings
463 3 my $fallback;
464 3 ▶ if ( $_[0] =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] =~ /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/) { } 1 2 3
465 1 $fallback = sprintf "%f", $_[0];
466 } else {
467 2 ▶ ($fallback) = $_[0] ? ($_[0] =~ /^([0-9.]+)/) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 2 0 2
468 2 $fallback += 0;
469 2 carp "Unparsable version '$_[0]' for prerequisite $_[1] treated as $fallback";
470 }
471 3 version->new($fallback);
472 },
473 },
474 856 );
475 856 $self->{$key} = $cmr->as_string_hash;
476 856 $key2cmr{$key} = $cmr;
477 } else {
478 56 for my $module (sort keys %{ $self->{$key} }) {
479 14 my $version = $self->{$key}->{$module};
480 14 my $fallback = 0;
481 14 ▶ if (!defined($version) or !length($version)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $version && length $version) { } 2 12 14
elsif ($version =~ /^\d+(?:\.\d+(?:_\d+)*)?$/) { } 3 9 12
Condition100%3/3
defined $version && length $version
!ll&&!rl&&r
1112
MC/DC100%2/2
defined $version && length $version
defined $version length $version
Truth table100%3/3
A && B
A= defined $versionB= length $version
ABresult
0X0
100
111
482 2 carp "Undefined requirement for $module treated as '0' (CPAN::Meta::Requirements not available)";
483 }
484 elsif ($version =~ /^\d+(?:\.\d+(?:_\d+)*)?$/) {
485 3 next;
486 }
487 else {
488 9 ▶ if ( $version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($version =~ /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/) { } 1 8 9
489 1 $fallback = sprintf "%f", $version;
490 } else {
491 8 ▶ ($fallback) = $version ? ($version =~ /^([0-9.]+)/) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 8 0 8
492 8 $fallback += 0;
493 8 carp "Unparsable version '$version' for prerequisite $module treated as $fallback (CPAN::Meta::Requirements not available)";
494 }
495 }
496 11 $self->{$key}->{$module} = $fallback;
497 }
498 }
499 }
500  
501 228 ▶ if ("@ARGV" =~ /\bPREREQ_PRINT\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (join($", @ARGV) =~ /\bPREREQ_PRINT\b/) 2 226 228
502 2 $self->_PREREQ_PRINT;
503 }
504  
505 # PRINT_PREREQ is RedHatism.
506 226 ▶ if ("@ARGV" =~ /\bPRINT_PREREQ\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (join($", @ARGV) =~ /\bPRINT_PREREQ\b/) 2 224 226
507 2 $self->_PRINT_PREREQ;
508 }
509  
510 224 ▶ print "MakeMaker (v$VERSION)\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose 0 224 224
511 224 ▶ if (-f "MANIFEST" && ! -f "Makefile" && ! $UNDER_CORE){
Branch: 1 branch
BranchTrueFalseTotal
if (-f "MANIFEST" and not -f "Makefile" and not $ExtUtils::MakeMaker::UNDER_CORE) 6 218 224
Condition83%5/6
-f "MANIFEST" and not -f "Makefile" and not $ExtUtils::MakeMaker::UNDER_CORE
!ll&&!rl&&r
21806
-f "MANIFEST" and not -f "Makefile"
!ll&&!rl&&r
21356
MC/DC66%2/3
-f "MANIFEST" and not -f "Makefile" and not $ExtUtils::MakeMaker::UNDER_CORE
-f "MANIFEST" not -f "Makefile" not $ExtUtils::MakeMaker::UNDER_CORE
Truth table75%3/4
A and not(B) and not(C)
A= -f "MANIFEST"B= not -f "Makefile"C= not $ExtUtils::MakeMaker::UNDER_CORE
ABCresult
0XX0
10X0
1100
1111
512 6 check_manifest();
513 }
514  
515 224 check_hints($self);
516  
517 224 ▶ if ( $self->{MIN_PERL_VERSION}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"MIN_PERL_VERSION"}) 9 215 224
518 9 my $perl_version = $self->{MIN_PERL_VERSION};
519 9 ▶ if (ref $perl_version) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $perl_version) { } 0 9 9
520 # assume a version object
521 }
522 else {
523 9 $perl_version = eval {
524 0 ▶ local $SIG{__WARN__} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
525 # simulate "use warnings FATAL => 'all'" for vintage perls
526 0 die @_;
527 9 };
528 9 my $v = version->new($perl_version);
529 # we care about parse issues, not numify warnings
530 96 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
531 8 $v->numify;
532 };
533 9 ▶ $perl_version =~ tr/_//d
Branch: 1 branch
BranchTrueFalseTotal
if defined $perl_version 8 1 9
534 if defined $perl_version;
535 }
536  
537 9 ▶ if (!defined $perl_version) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $perl_version) { } 1 8 9
elsif ($perl_version > "$]") { } 2 6 8
538 # should this be a warning?
539 1 die sprintf <<'END', $self->{MIN_PERL_VERSION};
540 MakeMaker FATAL: MIN_PERL_VERSION (%s) is not in a recognized format.
541 Recommended is a quoted numerical value like '5.005' or '5.008001'.
542 END
543 }
544 elsif ($perl_version > "$]") {
545 2 my $message = sprintf <<'END', $perl_version, $];
546 Perl version %s or higher required. We run %s.
547 END
548 2 ▶ if ($self->{PREREQ_FATAL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'PREREQ_FATAL'}) { } 1 1 2
549 1 die "MakeMaker FATAL: $message";
550 }
551 else {
552 1 warn "Warning: $message";
553 }
554 }
555  
556 7 $self->{MIN_PERL_VERSION} = $perl_version;
557 }
558  
559 222 my %configure_att; # record &{$self->{CONFIGURE}} attributes
560 222 my(%initial_att) = %$self; # record initial attributes
561  
562 222 my(%unsatisfied) = ();
563 222 my %prereq2version;
564 my $cmr;
565 222 ▶ if (_has_cpan_meta_requirements) {
Branch: 1 branch
BranchTrueFalseTotal
if (_has_cpan_meta_requirements()) { } 208 14 222
566 208 $cmr = CPAN::Meta::Requirements->new;
567 208 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
568 832 ▶ $cmr->add_requirements($key2cmr{$key}) if $key2cmr{$key};
Branch: 1 branch
BranchTrueFalseTotal
if $key2cmr{$key} 832 0 832
569 }
570 208 foreach my $prereq ($cmr->required_modules) {
571 64 $prereq2version{$prereq} = $cmr->requirements_for_module($prereq);
572 }
573 } else {
574 14 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
575 56 ▶ next unless my $module2version = $self->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless my $module2version = $self->{$key} 0 56 56
576 56 $prereq2version{$_} = $module2version->{$_} for keys %$module2version;
577 }
578 }
579 222 foreach my $prereq (sort keys %prereq2version) {
580 78 my $required_version = $prereq2version{$prereq};
581  
582 78 my $pr_version = 0;
583 78 my $installed_file;
584  
585 78 ▶ if ( $prereq eq 'perl' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prereq eq 'perl') { } 0 78 78
586 0 ▶ if ( defined $required_version && $required_version =~ /^v?[\d_\.]+$/
Branch: 1 branch
BranchTrueFalseTotal
if (defined $required_version and $required_version =~ /^v?[\d_\.]+$/ or not $required_version =~ /^v?[\d_\.]+$/) 0 0 0
Condition0%0/6
defined $required_version and $required_version =~ /^v?[\d_\.]+$/ or not $required_version =~ /^v?[\d_\.]+$/
l!l&&r!l&&!r
000
defined $required_version and $required_version =~ /^v?[\d_\.]+$/
!ll&&!rl&&r
000
MC/DC0%0/3
defined $required_version and $required_version =~ /^v?[\d_\.]+$/ or not $required_version =~ /^v?[\d_\.]+$/
defined $required_version $required_version =~ /^v?[\d_\.]+$/ not $required_version =~ /^v?[\d_\.]+$/
Truth table0%0/5
A and B or not(C)
A= defined $required_versionB= $required_version =~ /^v?[\d_\.]+$/C= not $required_version =~ /^v?[\d_\.]+$/
ABCresult
11X1
0X11
1011
0X00
1000
587 || $required_version !~ /^v?[\d_\.]+$/ ) {
588 0 require version;
589 0 my $normal = eval { version->new( $required_version ) };
590 0 ▶ $required_version = $normal if defined $normal;
Branch: 1 branch
BranchTrueFalseTotal
if defined $normal 0 0 0
591 }
592 0 $installed_file = $prereq;
593 0 $pr_version = $];
594 }
595 else {
596 78 $installed_file = MM->_installed_file_for_module($prereq);
597 78 ▶ $pr_version = MM->parse_version($installed_file) if $installed_file;
Branch: 1 branch
BranchTrueFalseTotal
if $installed_file 41 37 78
598 78 ▶ $pr_version = 0 if $pr_version eq 'undef';
Branch: 1 branch
BranchTrueFalseTotal
if $pr_version eq "undef" 0 78 78
599 78 ▶ if ( !eval { version->new( $pr_version ); 1 } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { "version"->new($pr_version); 1 } }) 0 78 78
600 #no warnings 'numeric'; # module doesn't use warnings
601 0 my $fallback;
602 0 ▶ if ( $pr_version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pr_version =~ /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/) { } 0 0 0
603 0 $fallback = sprintf '%f', $pr_version;
604 } else {
605 0 ▶ ($fallback) = $pr_version ? ($pr_version =~ /^([0-9.]+)/) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$pr_version ? : 0 0 0
606 0 $fallback += 0;
607 0 carp "Unparsable version '$pr_version' for installed prerequisite $prereq treated as $fallback";
608 }
609 0 $pr_version = $fallback;
610 }
611 }
612  
613 # convert X.Y_Z alpha version #s to X.YZ for easier comparisons
614 78 $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
615  
616 78 ▶ if (!$installed_file) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $installed_file) { } 37 41 78
elsif ($cmr ? !$cmr->accepts_module($prereq, $pr_version) : 'version'->new($required_version) > 'version'->new($pr_version)) { } 3 38 41
617 warn sprintf "Warning: prerequisite %s %s not found.\n",
618 $prereq, $required_version
619 unless $self->{PREREQ_FATAL}
620 37 ▶ or $UNDER_CORE;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"PREREQ_FATAL"} or $ExtUtils::MakeMaker::UNDER_CORE 34 3 37
Condition66%2/3
$self->{"PREREQ_FATAL"} or $ExtUtils::MakeMaker::UNDER_CORE
l!l&&r!l&&!r
3034
MC/DC50%1/2
$self->{"PREREQ_FATAL"} or $ExtUtils::MakeMaker::UNDER_CORE
$self->{"PREREQ_FATAL"} $ExtUtils::MakeMaker::UNDER_CORE
Truth table66%2/3
A or B
A= $self->{"PREREQ_FATAL"}B= $ExtUtils::MakeMaker::UNDER_CORE
ABresult
1X1
011
000
621  
622 37 $unsatisfied{$prereq} = 'not installed';
623 }
624 ▶ elsif (
Branch: 1 branch
BranchTrueFalseTotal
$cmr ? : 41 0 41
625 $cmr
626 ? !$cmr->accepts_module($prereq, $pr_version)
627 : version->new($required_version) > version->new($pr_version)
628 ) {
629 warn sprintf "Warning: prerequisite %s %s not found. We have %s.\n",
630 $prereq, $required_version, ($pr_version || 'unknown version')
631 unless $self->{PREREQ_FATAL}
632 3 ▶ or $UNDER_CORE;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"PREREQ_FATAL"} or $ExtUtils::MakeMaker::UNDER_CORE 2 1 3
Condition60%3/5
$self->{"PREREQ_FATAL"} or $ExtUtils::MakeMaker::UNDER_CORE
l!l&&r!l&&!r
102
$pr_version || 'unknown version'
l!l
20
MC/DC50%1/2
$self->{"PREREQ_FATAL"} or $ExtUtils::MakeMaker::UNDER_CORE
$self->{"PREREQ_FATAL"} $ExtUtils::MakeMaker::UNDER_CORE
MC/DC0%0/1
$pr_version || 'unknown version'
$pr_version
Truth table66%2/3
A or B
A= $self->{"PREREQ_FATAL"}B= $ExtUtils::MakeMaker::UNDER_CORE
ABresult
1X1
011
000
Truth table50%1/2
A
A= $pr_version
Aresult
11
00
633  
634 3 ▶ $unsatisfied{$prereq} = $required_version || 'unknown version' ;
Condition50%1/2
$required_version || 'unknown version'
l!l
30
MC/DC0%0/1
$required_version || 'unknown version'
$required_version
Truth table50%1/2
A
A= $required_version
Aresult
11
00
635 }
636 }
637  
638 222 ▶ if (%unsatisfied && $self->{PREREQ_FATAL}){
Branch: 1 branch
BranchTrueFalseTotal
if (%unsatisfied and $self->{"PREREQ_FATAL"}) 2 220 222
Condition100%3/3
%unsatisfied and $self->{"PREREQ_FATAL"}
!ll&&!rl&&r
185352
MC/DC100%2/2
%unsatisfied and $self->{"PREREQ_FATAL"}
%unsatisfied $self->{"PREREQ_FATAL"}
Truth table100%3/3
A and B
A= %unsatisfiedB= $self->{"PREREQ_FATAL"}
ABresult
0X0
100
111
639 4 my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"}
640 2 sort { lc $a cmp lc $b } keys %unsatisfied;
641 2 die <<"END";
642 MakeMaker FATAL: prerequisites not found.
643 $failedprereqs
644  
645 Please install these modules first and rerun 'perl Makefile.PL'.
646 END
647 }
648  
649 220 ▶ if (defined $self->{CONFIGURE}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"CONFIGURE"}) 1 219 220
650 1 ▶ if (ref $self->{CONFIGURE} eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'CONFIGURE'} eq 'CODE') { } 1 0 1
651 1 %configure_att = %{&{$self->{CONFIGURE}}};
652 1 _convert_compat_attrs(\%configure_att);
653 1 $self = { %$self, %configure_att };
654 } else {
655 0 croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
656 }
657 }
658  
659 220 my $newclass = ++$PACKNAME;
660 220 local @Parent = @Parent; # Protect against non-local exits
661 {
662 220 ▶ print "Blessing Object into class [$newclass]\n" if $Verbose>=2;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose >= 2 0 220 220
663 220 mv_all_methods("MY",$newclass);
664 220 bless $self, $newclass;
665 220 push @Parent, $self;
666 220 require ExtUtils::MY;
667  
668 96 ▶ no strict 'refs'; ## no critic;
Subroutine BEGIN: called CC=1 SCAR=0.0
669 220 @{"$newclass\:\:ISA"} = 'MM';
670 }
671  
672 220 ▶ if (defined $Parent[-2]){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ExtUtils::MakeMaker::Parent[-2]) { } 79 141 220
673 79 $self->{PARENT} = $Parent[-2];
674 79 for my $key (@Prepend_parent) {
675 790 ▶ next unless defined $self->{PARENT}{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"PARENT"}{$key} 79 711 790
676  
677 # Don't stomp on WriteMakefile() args.
678 next if defined $self->{ARGS}{$key} and
679 711 ▶ $self->{ARGS}{$key} eq $self->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"ARGS"}{$key} and $self->{"ARGS"}{$key} eq $self->{$key} 6 705 711
Condition66%2/3
defined $self->{"ARGS"}{$key} and $self->{"ARGS"}{$key} eq $self->{$key}
!ll&&!rl&&r
70506
MC/DC50%1/2
defined $self->{"ARGS"}{$key} and $self->{"ARGS"}{$key} eq $self->{$key}
defined $self->{"ARGS"}{$key} $self->{"ARGS"}{$key} eq $self->{$key}
Truth table66%2/3
A and B
A= defined $self->{"ARGS"}{$key}B= $self->{"ARGS"}{$key} eq $self->{$key}
ABresult
0X0
100
111
680  
681 705 $self->{$key} = $self->{PARENT}{$key};
682  
683 705 ▶ if ($Is_VMS && $key =~ /PERL$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is_VMS and $key =~ /PERL$/) { } 0 705 705
Condition33%1/3
$Is_VMS and $key =~ /PERL$/
!ll&&!rl&&r
70500
MC/DC0%0/2
$Is_VMS and $key =~ /PERL$/
$Is_VMS $key =~ /PERL$/
Truth table33%1/3
A and B
A= $Is_VMSB= $key =~ /PERL$/
ABresult
0X0
100
111
684 # PERL or FULLPERL will be a command verb or even a
685 # command with an argument instead of a full file
686 # specification under VMS. So, don't turn the command
687 # into a filespec, but do add a level to the path of
688 # the argument if not already absolute.
689 0 my @cmd = split /\s+/, $self->{$key};
690 0 ▶ $cmd[1] = $self->catfile('[-]',$cmd[1])
Branch: 1 branch
BranchTrueFalseTotal
unless @cmd < 2 or $self->file_name_is_absolute($cmd[1]) 0 0 0
Condition0%0/3
@cmd < 2 or $self->file_name_is_absolute($cmd[1])
l!l&&r!l&&!r
000
MC/DC0%0/2
@cmd < 2 or $self->file_name_is_absolute($cmd[1])
@cmd < 2 $self->file_name_is_absolute($cmd[1])
Truth table0%0/3
A or B
A= @cmd < 2B= $self->file_name_is_absolute($cmd[1])
ABresult
1X1
011
000
691 unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]);
692 0 $self->{$key} = join(' ', @cmd);
693 } else {
694 705 my $value = $self->{$key};
695 # not going to test in FS so only stripping start
696 705 ▶ $value =~ s/^"// if $key =~ /PERL$/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /PERL$/ 152 553 705
697 705 ▶ $value = $self->catdir("..", $value)
Branch: 1 branch
BranchTrueFalseTotal
unless $self->file_name_is_absolute($value) 553 152 705
698 unless $self->file_name_is_absolute($value);
699 705 ▶ $value = qq{"$value} if $key =~ /PERL$/;
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /PERL$/ 152 553 705
700 705 $self->{$key} = $value;
701 }
702 }
703 79 ▶ if ($self->{PARENT}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PARENT"}) 79 0 79
704 79 $self->{PARENT}->{CHILDREN}->{$newclass} = $self;
705 79 foreach my $opt (qw(POLLUTE PERL_CORE LINKTYPE AR FULL_AR CC CCFLAGS
706 OPTIMIZE LD LDDLFLAGS LDFLAGS PERL_ARCHLIB DESTDIR)) {
707 1027 ▶ if (exists $self->{PARENT}->{$opt}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"PARENT"}{$opt} and not exists $self->{$opt}) 791 236 1027
Condition66%2/3
exists $self->{"PARENT"}{$opt} and not exists $self->{$opt}
!ll&&!rl&&r
2360791
MC/DC50%1/2
exists $self->{"PARENT"}{$opt} and not exists $self->{$opt}
exists $self->{"PARENT"}{$opt} not exists $self->{$opt}
Truth table66%2/3
A and not(B)
A= exists $self->{"PARENT"}{$opt}B= not exists $self->{$opt}
ABresult
0X0
100
111
708 and not exists $self->{$opt})
709 {
710 # inherit, but only if already unspecified
711 791 $self->{$opt} = $self->{PARENT}->{$opt};
712 }
713 }
714 }
715 79 my @fm = grep /^FIRST_MAKEFILE=/, @ARGV;
716 79 ▶ parse_args($self,@fm) if @fm;
Branch: 1 branch
BranchTrueFalseTotal
if @fm 1 78 79
717 }
718 else {
719 141 ▶ parse_args($self, _shellwords($ENV{PERL_MM_OPT} || ''),@ARGV);
Condition100%2/2
$ENV{'PERL_MM_OPT'} || ''
l!l
3138
MC/DC100%1/1
$ENV{'PERL_MM_OPT'} || ''
$ENV{'PERL_MM_OPT'}
Truth table100%2/2
A
A= $ENV{'PERL_MM_OPT'}
Aresult
11
00
720 }
721  
722 # RT#91540 PREREQ_FATAL not recognized on command line
723 220 ▶ if (%unsatisfied && $self->{PREREQ_FATAL}){
Branch: 1 branch
BranchTrueFalseTotal
if (%unsatisfied and $self->{"PREREQ_FATAL"}) 1 219 220
Condition100%3/3
%unsatisfied and $self->{"PREREQ_FATAL"}
!ll&&!rl&&r
185341
MC/DC100%2/2
%unsatisfied and $self->{"PREREQ_FATAL"}
%unsatisfied $self->{"PREREQ_FATAL"}
Truth table100%3/3
A and B
A= %unsatisfiedB= $self->{"PREREQ_FATAL"}
ABresult
0X0
100
111
724 1 my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"}
725 0 sort { lc $a cmp lc $b } keys %unsatisfied;
726 1 die <<"END";
727 MakeMaker FATAL: prerequisites not found.
728 $failedprereqs
729  
730 Please install these modules first and rerun 'perl Makefile.PL'.
731 END
732 }
733  
734 219 ▶ $self->{NAME} ||= $self->guess_name;
Condition33%1/3
$self->{"NAME"} ||= $self->guess_name
l!l&&r!l&&!r
21900
MC/DC0%0/2
$self->{"NAME"} ||= $self->guess_name
$self->{"NAME"} $self->guess_name
Truth table33%1/3
A ||= B
A= $self->{"NAME"}B= $self->guess_name
ABresult
1X1
011
000
735  
736 warn "Warning: NAME must be a package name\n"
737 219 ▶ unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"NAME"} =~ /^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$/ 0 219 219
738  
739 219 ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
740  
741 219 $self->init_MAKE;
742 219 $self->init_main;
743 219 $self->init_VERSION;
744 219 $self->init_dist;
745 219 $self->init_INST;
746 219 $self->init_INSTALL;
747 219 $self->init_DEST;
748 219 $self->init_dirscan;
749 219 $self->init_PM;
750 219 $self->init_MANPODS;
751 219 $self->init_xs;
752 219 $self->init_PERL;
753 219 $self->init_DIRFILESEP;
754 219 $self->init_linker;
755 219 $self->init_ABSTRACT;
756  
757 $self->arch_check(
758 $INC{'Config.pm'},
759 219 $self->catfile($Config{'archlibexp'}, "Config.pm")
760 );
761  
762 219 $self->init_tools();
763 219 $self->init_others();
764 218 $self->init_platform();
765 218 $self->init_PERM();
766 218 my @args = @ARGV;
767 218 ▶ @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE;
Branch: 1 branch
BranchTrueFalseTotal
if $CAN_DECODE 218 0 218
768 218 my($argv) = neatvalue(\@args);
769 218 $argv =~ s/^\[/(/;
770 218 $argv =~ s/\]$/)/;
771  
772 218 push @{$self->{RESULT}}, <<END;
773 # This Makefile is for the $self->{NAME} extension to perl.
774 #
775 # It was generated automatically by MakeMaker version
776 # $VERSION (Revision: $Revision) from the contents of
777 # Makefile.PL. Don't edit this file, edit Makefile.PL instead.
778 #
779 # ANY CHANGES MADE HERE WILL BE LOST!
780 #
781 # MakeMaker ARGV: $argv
782 #
783 END
784  
785 218 push @{$self->{RESULT}}, $self->_MakeMaker_Parameters_section(\%initial_att);
786  
787 218 ▶ if (defined $self->{CONFIGURE}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"CONFIGURE"}) 1 217 218
788 1 push @{$self->{RESULT}}, <<END;
789  
790 # MakeMaker 'CONFIGURE' Parameters:
791 END
792 1 ▶ if (scalar(keys %configure_att) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %configure_att > 0) { } 1 0 1
793 1 foreach my $key (sort keys %configure_att){
794 1 ▶ next if $key eq 'ARGS';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "ARGS" 0 1 1
795 1 my($v) = neatvalue($configure_att{$key});
796 1 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
797 1 $v =~ tr/\n/ /s;
798 1 push @{$self->{RESULT}}, "# $key => $v";
799 }
800 }
801 else
802 {
803 0 push @{$self->{RESULT}}, "# no values returned";
804 }
805 1 undef %configure_att; # free memory
806 }
807  
808 # turn the SKIP array into a SKIPHASH hash
809 218 ▶ for my $skip (@{$self->{SKIP} || []}) {
Condition100%2/2
$self->{'SKIP'} || []
l!l
3215
MC/DC100%1/1
$self->{'SKIP'} || []
$self->{'SKIP'}
Truth table100%2/2
A
A= $self->{'SKIP'}
Aresult
11
00
810 15 $self->{SKIPHASH}{$skip} = 1;
811 }
812 218 delete $self->{SKIP}; # free memory
813  
814 218 ▶ if ($self->{PARENT}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PARENT"}) 79 139 218
815 79 for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) {
816 553 $self->{SKIPHASH}{$_} = 1;
817 }
818 }
819  
820 # We run all the subdirectories now. They don't have much to query
821 # from the parent, but the parent has to query them: if they need linking!
822 218 ▶ unless ($self->{NORECURS}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"NORECURS"}) 215 3 218
823 215 ▶ $self->eval_in_subdirs if @{$self->{DIR}};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->{"DIR"};} 79 136 215
824 }
825  
826 218 foreach my $section ( @MM_Sections ){
827 # Support for new foo_target() methods.
828 12155 my $method = $section;
829 12155 ▶ $method .= '_target' unless $self->can($method);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can($method) 1736 10419 12155
830  
831 12155 ▶ print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose >= 2 0 12155 12155
832 12155 my($skipit) = $self->skipcheck($section);
833 12155 ▶ if ($skipit){
Branch: 1 branch
BranchTrueFalseTotal
if ($skipit) { } 564 11591 12155
834 564 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
835 } else {
836 11591 ▶ my(%a) = %{$self->{$section} || {}};
Condition100%2/2
$self->{$section} || {}
l!l
511586
MC/DC100%1/1
$self->{$section} || {}
$self->{$section}
Truth table100%2/2
A
A= $self->{$section}
Aresult
11
00
837 11591 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
838 0 ▶ push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose and %a 0 11591 11591
Condition33%1/3
$ExtUtils::MakeMaker::Verbose and %a
!ll&&!rl&&r
1159100
MC/DC0%0/2
$ExtUtils::MakeMaker::Verbose and %a
$ExtUtils::MakeMaker::Verbose %a
Truth table33%1/3
A and B
A= $ExtUtils::MakeMaker::VerboseB= %a
ABresult
0X0
100
111
839 11591 push @{$self->{RESULT}}, $self->maketext_filter(
840 $self->$method( %a )
841 );
842 }
843 }
844  
845 217 push @{$self->{RESULT}}, "\n# End.";
846  
847 217 $self;
848 }
849  
850 2 ▶sub WriteEmptyMakefile {
Subroutine WriteEmptyMakefile: called CC=9 SCAR=26.0
Pod undocumented
851 2 ▶ croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @_ % 2 1 1 2
852  
853 1 my %att = @_;
854 1 ▶ $att{DIR} = [] unless $att{DIR}; # don't recurse by default
Branch: 1 branch
BranchTrueFalseTotal
unless $att{"DIR"} 1 0 1
855 1 my $self = MM->new(\%att);
856  
857 1 my $new = $self->{MAKEFILE};
858 1 my $old = $self->{MAKEFILE_OLD};
859 1 ▶ if (-f $old) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $old) 0 1 1
860 0 ▶ _unlink($old) or warn "unlink $old: $!";
Branch: 1 branch
BranchTrueFalseTotal
_unlink($old) or warn "unlink ${old}: $!" 0 0 0
861 }
862 1 ▶ if ( -f $new ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $new) 0 1 1
863 0 ▶ _rename($new, $old) or warn "rename $new => $old: $!"
Branch: 1 branch
BranchTrueFalseTotal
_rename($new, $old) or warn "rename $new => ${old}: $!" 0 0 0
864 }
865 1 ▶ open my $mfh, '>', $new or die "open $new for write: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $mfh, ">", $new or die "open $new for write: $!" 1 0 1
866 1 print $mfh <<'EOP';
867 all ::
868  
869 manifypods :
870  
871 subdirs ::
872  
873 dynamic ::
874  
875 static ::
876  
877 clean ::
878  
879 install ::
880  
881 makemakerdflt :
882  
883 test ::
884  
885 test_dynamic ::
886  
887 test_static ::
888  
889 EOP
890 1 ▶ close $mfh or die "close $new for write: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $mfh or die "close $new for write: $!" 1 0 1
891 }
892  
893  
894 =begin private
895  
896 =head3 _installed_file_for_module
897  
898 my $file = MM->_installed_file_for_module($module);
899  
900 Return the first installed .pm $file associated with the $module. The
901 one which will show up when you C<use $module>.
902  
903 $module is something like "strict" or "Test::More".
904  
905 =end private
906  
907 =cut
908  
909 82 ▶sub _installed_file_for_module {
Subroutine _installed_file_for_module: called CC=3 SCAR=11.0
910 82 my $class = shift;
911 82 my $prereq = shift;
912  
913 82 my $file = "$prereq.pm";
914 82 $file =~ s{::}{/}g;
915  
916 82 my $path;
917 82 for my $dir (@INC) {
918 783 my $tmp = File::Spec->catfile($dir, $file);
919 783 ▶ if ( -r $tmp ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-r $tmp) 43 740 783
920 43 $path = $tmp;
921 43 last;
922 }
923 }
924  
925 82 return $path;
926 }
927  
928  
929 # Extracted from MakeMaker->new so we can test it
930 224 ▶sub _MakeMaker_Parameters_section {
Subroutine _MakeMaker_Parameters_section: called CC=7 SCAR=19.5
931 224 my $self = shift;
932 224 my $att = shift;
933  
934 224 my @result = <<'END';
935 # MakeMaker Parameters:
936 END
937  
938 224 foreach my $key (sort keys %$att){
939 1757 ▶ next if $key eq 'ARGS';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "ARGS" 218 1539 1757
940 1539 my $v;
941 1539 ▶ if ($key eq 'PREREQ_PM') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'PREREQ_PM') { } 222 1317 1539
942 # CPAN.pm takes prereqs from this field in 'Makefile'
943 # and does not know about BUILD_REQUIRES
944 $v = neatvalue({
945 222 ▶ %{ $att->{PREREQ_PM} || {} },
Condition50%1/2
$att->{'PREREQ_PM'} || {}
l!l
2220
MC/DC0%0/1
$att->{'PREREQ_PM'} || {}
$att->{'PREREQ_PM'}
Truth table50%1/2
A
A= $att->{'PREREQ_PM'}
Aresult
11
00
946 222 ▶ %{ $att->{BUILD_REQUIRES} || {} },
Condition100%2/2
$att->{'BUILD_REQUIRES'} || {}
l!l
2202
MC/DC100%1/1
$att->{'BUILD_REQUIRES'} || {}
$att->{'BUILD_REQUIRES'}
Truth table100%2/2
A
A= $att->{'BUILD_REQUIRES'}
Aresult
11
00
947 222 ▶ %{ $att->{TEST_REQUIRES} || {} },
Condition100%2/2
$att->{'TEST_REQUIRES'} || {}
l!l
2184
MC/DC100%1/1
$att->{'TEST_REQUIRES'} || {}
$att->{'TEST_REQUIRES'}
Truth table100%2/2
A
A= $att->{'TEST_REQUIRES'}
Aresult
11
00
948 });
949 } else {
950 1317 $v = neatvalue($att->{$key});
951 }
952  
953 1539 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
954 1539 $v =~ tr/\n/ /s;
955 1539 push @result, "# $key => $v";
956 }
957  
958 224 return @result;
959 }
960  
961 # _shellwords and _parseline borrowed from Text::ParseWords
962 141 ▶sub _shellwords {
Subroutine _shellwords: called CC=6 SCAR=18.5
963 141 my (@lines) = @_;
964 141 my @allwords;
965  
966 141 foreach my $line (@lines) {
967 141 $line =~ s/^\s+//;
968 141 my @words = _parse_line('\s+', 0, $line);
969 141 ▶ pop @words if (@words and !defined $words[-1]);
Branch: 1 branch
BranchTrueFalseTotal
if @words and not defined $words[-1] 0 141 141
Condition66%2/3
@words and not defined $words[-1]
!ll&&!rl&&r
13830
MC/DC0%0/2
@words and not defined $words[-1]
@words not defined $words[-1]
Truth table66%2/3
A and not(B)
A= @wordsB= not defined $words[-1]
ABresult
0X0
100
111
970 141 ▶ return() unless (@words || !length($line));
Branch: 1 branch
BranchTrueFalseTotal
unless @words or not length $line 0 141 141
Condition66%2/3
@words or not length $line
l!l&&r!l&&!r
31380
MC/DC0%0/2
@words or not length $line
@words not length $line
Truth table66%2/3
A or not(B)
A= @wordsB= not length $line
ABresult
1X1
011
000
971 141 push(@allwords, @words);
972 }
973 141 return(@allwords);
974 }
975  
976 141 ▶sub _parse_line {
Subroutine _parse_line: called CC=14 SCAR=26.7
977 141 my($delimiter, $keep, $line) = @_;
978 141 my($word, @pieces);
979  
980 96 ▶ no warnings 'uninitialized'; # we will be testing undef strings
Subroutine BEGIN: called CC=1 SCAR=0.0
981  
982 141 ▶ while (length($line)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $line) 8 141 149
983 # This pattern is optimised to be stack conservative on older perls.
984 # Do not refactor without being careful and testing it on very long strings.
985 # See Perl bug #42980 for an example of a stack busting input.
986 8 ▶ $line =~ s/^
Branch: 1 branch
BranchTrueFalseTotal
$line =~ s/^ (?: # double quoted string (") # $quote ((?>[^\\"]*(?:\\.[^\\"]*)*))" # $quoted | # --OR-- # singe quoted string (') # $quote ((?>[^\\']*(?:\\.[^\\']*)*))' # $quoted | # --OR-- # unquoted string ( # $unquoted (?:\\.|[^\\"'])*? ) # followed by ( # $delim \Z(?!\n) # EOL | # --OR-- (?-x:$delimiter) # delimiter | # --OR-- (?!^)(?=["']) # a quote ) )//sx or return 8 0 8
987 (?:
988 # double quoted string
989 (") # $quote
990 ((?>[^\\"]*(?:\\.[^\\"]*)*))" # $quoted
991 | # --OR--
992 # singe quoted string
993 (') # $quote
994 ((?>[^\\']*(?:\\.[^\\']*)*))' # $quoted
995 | # --OR--
996 # unquoted string
997 ( # $unquoted
998 (?:\\.|[^\\"'])*?
999 )
1000 # followed by
1001 ( # $delim
1002 \Z(?!\n) # EOL
1003 | # --OR--
1004 (?-x:$delimiter) # delimiter
1005 | # --OR--
1006 (?!^)(?=["']) # a quote
1007 )
1008 )//xs or return; # extended layout
1009 8 ▶ my ($quote, $quoted, $unquoted, $delim) = (($1 ? ($1,$2) : ($3,$4)), $5, $6);
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 3 5 8
1010  
1011  
1012 8 ▶ return() unless( defined($quote) || length($unquoted) || length($delim));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $quote or length $unquoted or length $delim 0 8 8
Condition83%5/6
defined $quote or length $unquoted or length $delim
l!l&&r!l&&!r
710
defined $quote or length $unquoted
l!l&&r!l&&!r
341
MC/DC0%0/3
defined $quote or length $unquoted or length $delim
defined $quote length $unquoted length $delim
Truth table75%3/4
A or B or C
A= defined $quoteB= length $unquotedC= length $delim
ABCresult
1XX1
01X1
0011
0000
1013  
1014 8 ▶ if ($keep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($keep) { } 0 8 8
1015 0 $quoted = "$quote$quoted$quote";
1016 }
1017 else {
1018 8 $unquoted =~ s/\\(.)/$1/sg;
1019 8 ▶ if (defined $quote) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $quote) 3 5 8
1020 3 ▶ $quoted =~ s/\\(.)/$1/sg if ($quote eq '"');
Branch: 1 branch
BranchTrueFalseTotal
if $quote eq "\"" 3 0 3
1021 #$quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'");
1022 }
1023 }
1024 8 $word .= substr($line, 0, 0); # leave results tainted
1025 8 ▶ $word .= defined $quote ? $quoted : $unquoted;
Branch: 1 branch
BranchTrueFalseTotal
defined $quote ? : 3 5 8
1026  
1027 8 ▶ if (length($delim)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $delim) 1 7 8
1028 1 push(@pieces, $word);
1029 1 ▶ push(@pieces, $delim) if ($keep eq 'delimiters');
Branch: 1 branch
BranchTrueFalseTotal
if $keep eq "delimiters" 0 1 1
1030 1 undef $word;
1031 }
1032 8 ▶ if (!length($line)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $line) 3 5 8
1033 3 push(@pieces, $word);
1034 }
1035 }
1036 141 return(@pieces);
1037 }
1038  
1039 6 ▶sub check_manifest {
Subroutine check_manifest: called CC=2 SCAR=6.9
Pod undocumented
1040 6 print STDOUT "Checking if your kit is complete...\n";
1041 6 require ExtUtils::Manifest;
1042 # avoid warning
1043 6 $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1;
1044 6 my(@missed) = ExtUtils::Manifest::manicheck();
1045 6 ▶ if (@missed) {
Branch: 1 branch
BranchTrueFalseTotal
if (@missed) { } 4 2 6
1046 4 print "Warning: the following files are missing in your kit:\n";
1047 4 print "\t", join "\n\t", @missed;
1048 4 print "\n";
1049 4 print "Please inform the author.\n";
1050 } else {
1051 2 print "Looks good\n";
1052 }
1053 }
1054  
1055 142 ▶sub parse_args{
Subroutine parse_args: called CC=24 SCAR=48.2
Pod undocumented
1056 142 my($self, @args) = @_;
1057 142 ▶ @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE;
Branch: 1 branch
BranchTrueFalseTotal
if $CAN_DECODE 142 0 142
1058 142 foreach (@args) {
1059 19 ▶ unless (m/(.*?)=(.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/(.*?)=(.*)/) 0 19 19
1060 0 ▶ ++$Verbose if m/^verb/;
Branch: 1 branch
BranchTrueFalseTotal
if /^verb/ 0 0 0
1061 0 next;
1062 }
1063 19 my($name, $value) = ($1, $2);
1064 19 ▶ if ($value =~ m/^~(\w+)?/) { # tilde with optional username
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /^~(\w+)?/) 0 19 19
1065 0 $value =~ s [^~(\w*)]
1066 0 ▶ [$1 ?
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
Condition0%0/2
(getpwnam $1)[7] or "~$1"
l!l
00
MC/DC0%0/1
(getpwnam $1)[7] or "~$1"
(getpwnam $1)[7]
Truth table0%0/2
A
A= (getpwnam $1)[7]
Aresult
11
00
1067 ((getpwnam($1))[7] || "~$1") :
1068 (getpwuid($>))[7]
1069 ]ex;
1070 }
1071  
1072 # Remember the original args passed it. It will be useful later.
1073 19 $self->{ARGS}{uc $name} = $self->{uc $name} = $value;
1074 }
1075  
1076 # catch old-style 'potential_libs' and inform user how to 'upgrade'
1077 142 ▶ if (defined $self->{potential_libs}){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"potential_libs"}) 0 142 142
1078 0 my($msg)="'potential_libs' => '$self->{potential_libs}' should be";
1079 0 ▶ if ($self->{potential_libs}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'potential_libs'}) { } 0 0 0
1080 0 print "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n";
1081 } else {
1082 0 print "$msg deleted.\n";
1083 }
1084 0 $self->{LIBS} = [$self->{potential_libs}];
1085 0 delete $self->{potential_libs};
1086 }
1087 # catch old-style 'ARMAYBE' and inform user how to 'upgrade'
1088 142 ▶ if (defined $self->{ARMAYBE}){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"ARMAYBE"}) 0 142 142
1089 0 my($armaybe) = $self->{ARMAYBE};
1090 0 print "ARMAYBE => '$armaybe' should be changed to:\n",
1091 "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n";
1092 0 ▶ my(%dl) = %{$self->{dynamic_lib} || {}};
Condition0%0/2
$self->{'dynamic_lib'} || {}
l!l
00
MC/DC0%0/1
$self->{'dynamic_lib'} || {}
$self->{'dynamic_lib'}
Truth table0%0/2
A
A= $self->{'dynamic_lib'}
Aresult
11
00
1093 0 $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe};
1094 0 delete $self->{ARMAYBE};
1095 }
1096 142 ▶ if (defined $self->{LDTARGET}){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"LDTARGET"}) 0 142 142
1097 0 print "LDTARGET should be changed to LDFROM\n";
1098 0 $self->{LDFROM} = $self->{LDTARGET};
1099 0 delete $self->{LDTARGET};
1100 }
1101 # Turn a DIR argument on the command line into an array
1102 142 ▶ if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"DIR"} and ref \$self->{"DIR"} eq "SCALAR") 0 142 142
Condition66%2/3
defined $self->{"DIR"} and ref \$self->{"DIR"} eq "SCALAR"
!ll&&!rl&&r
14110
MC/DC0%0/2
defined $self->{"DIR"} and ref \$self->{"DIR"} eq "SCALAR"
defined $self->{"DIR"} ref \$self->{"DIR"} eq "SCALAR"
Truth table66%2/3
A and B
A= defined $self->{"DIR"}B= ref \$self->{"DIR"} eq "SCALAR"
ABresult
0X0
100
111
1103 # So they can choose from the command line, which extensions they want
1104 # the grep enables them to have some colons too much in case they
1105 # have to build a list with the shell
1106 0 $self->{DIR} = [grep $_, split ":", $self->{DIR}];
1107 }
1108 # Turn a INCLUDE_EXT argument on the command line into an array
1109 142 ▶ if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"INCLUDE_EXT"} and ref \$self->{"INCLUDE_EXT"} eq "SCALAR") 0 142 142
Condition33%1/3
defined $self->{"INCLUDE_EXT"} and ref \$self->{"INCLUDE_EXT"} eq "SCALAR"
!ll&&!rl&&r
14200
MC/DC0%0/2
defined $self->{"INCLUDE_EXT"} and ref \$self->{"INCLUDE_EXT"} eq "SCALAR"
defined $self->{"INCLUDE_EXT"} ref \$self->{"INCLUDE_EXT"} eq "SCALAR"
Truth table33%1/3
A and B
A= defined $self->{"INCLUDE_EXT"}B= ref \$self->{"INCLUDE_EXT"} eq "SCALAR"
ABresult
0X0
100
111
1110 0 $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}];
1111 }
1112 # Turn a EXCLUDE_EXT argument on the command line into an array
1113 142 ▶ if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"EXCLUDE_EXT"} and ref \$self->{"EXCLUDE_EXT"} eq "SCALAR") 0 142 142
Condition33%1/3
defined $self->{"EXCLUDE_EXT"} and ref \$self->{"EXCLUDE_EXT"} eq "SCALAR"
!ll&&!rl&&r
14200
MC/DC0%0/2
defined $self->{"EXCLUDE_EXT"} and ref \$self->{"EXCLUDE_EXT"} eq "SCALAR"
defined $self->{"EXCLUDE_EXT"} ref \$self->{"EXCLUDE_EXT"} eq "SCALAR"
Truth table33%1/3
A and B
A= defined $self->{"EXCLUDE_EXT"}B= ref \$self->{"EXCLUDE_EXT"} eq "SCALAR"
ABresult
0X0
100
111
1114 0 $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}];
1115 }
1116  
1117 142 foreach my $mmkey (sort keys %$self){
1118 1167 ▶ next if $mmkey eq 'ARGS';
Branch: 1 branch
BranchTrueFalseTotal
if $mmkey eq "ARGS" 142 1025 1167
1119 1025 ▶ print " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose 0 1025 1025
1120 print "'$mmkey' is not a known MakeMaker parameter name.\n"
1121 1025 ▶ unless exists $Recognized_Att_Keys{$mmkey};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $ExtUtils::MakeMaker::Recognized_Att_Keys{$mmkey} 4 1021 1025
1122 }
1123 142 ▶ $| = 1 if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose 0 142 142
1124 }
1125  
1126 226 ▶sub check_hints {
Subroutine check_hints: called CC=6 SCAR=18.0
Pod undocumented
1127 226 my($self) = @_;
1128 # We allow extension-specific hints files.
1129  
1130 226 require File::Spec;
1131 226 my $curdir = File::Spec->curdir;
1132  
1133 226 my $hint_dir = File::Spec->catdir($curdir, "hints");
1134 226 ▶ return unless -d $hint_dir;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $hint_dir 224 2 226
1135  
1136 # First we look for the best hintsfile we have
1137 2 my($hint)="${^O}_$Config{osvers}";
1138 2 $hint =~ s/\./_/g;
1139 2 $hint =~ s/_$//;
1140 2 ▶ return unless $hint;
Branch: 1 branch
BranchTrueFalseTotal
unless $hint 0 2 2
1141  
1142 # Also try without trailing minor version numbers.
1143 2 while (1) {
1144 8 ▶ last if -f File::Spec->catfile($hint_dir, "$hint.pl"); # found
Branch: 1 branch
BranchTrueFalseTotal
if -f "File::Spec"->catfile($hint_dir, "$hint.pl") 2 6 8
1145 } continue {
1146 6 ▶ last unless $hint =~ s/_[^_]*$//; # nothing to cut off
Branch: 1 branch
BranchTrueFalseTotal
unless $hint =~ s/_[^_]*$// 0 6 6
1147 }
1148 2 my $hint_file = File::Spec->catfile($hint_dir, "$hint.pl");
1149  
1150 2 ▶ return unless -f $hint_file; # really there
Branch: 1 branch
BranchTrueFalseTotal
unless -f $hint_file 0 2 2
1151  
1152 2 _run_hintfile($self, $hint_file);
1153 }
1154  
1155 2 ▶sub _run_hintfile {
Subroutine _run_hintfile: called CC=4 SCAR=14.1
1156 2 our $self;
1157 2 local($self) = shift; # make $self available to the hint file.
1158 2 my($hint_file) = shift;
1159  
1160 2 local($@, $!);
1161 2 ▶ print "Processing hints file $hint_file\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose 0 2 2
1162  
1163 # Just in case the ./ isn't on the hint file, which File::Spec can
1164 # often strip off, we bung the curdir into @INC
1165 2 local @INC = (File::Spec->curdir, @INC);
1166 2 my $ret = do $hint_file;
1167 2 ▶ if( !defined $ret ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $ret) 1 1 2
1168 1 ▶ my $error = $@ || $!;
Condition33%1/3
$@ || $!
l!l&&r!l&&!r
100
MC/DC0%0/2
$@ || $!
$@ $!
Truth table33%1/3
A || B
A= $@B= $!
ABresult
1X1
011
000
1169 1 warn $error;
1170 }
1171 }
1172  
1173 220 ▶sub mv_all_methods {
Subroutine mv_all_methods: called CC=3 SCAR=11.0
Pod undocumented
1174 220 my($from,$to) = @_;
1175 12 ▶ local $SIG{__WARN__} = sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
1176 # can't use 'no warnings redefined', 5.6 only
1177 12 ▶ warn @_ unless $_[0] =~ /^Subroutine .* redefined/
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] =~ /^Subroutine .* redefined/ 0 12 12
1178 220 };
1179 220 foreach my $method (@Overridable) {
1180 15840 ▶ next unless defined &{"${from}::$method"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined &{"${from}::$method";} 15828 12 15840
1181 96 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
1182 12 *{"${to}::$method"} = \&{"${from}::$method"};
1183  
1184 # If we delete a method, then it will be undefined and cannot
1185 # be called. But as long as we have Makefile.PLs that rely on
1186 # %MY:: being intact, we have to fill the hole with an
1187 # inheriting method:
1188  
1189 {
1190 12 package MY;
1191 12 my $super = "SUPER::".$method;
1192 12 ▶ *{$method} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
1193 3 shift->$super(@_);
1194 12 };
1195 }
1196 }
1197 }
1198  
1199 12155 ▶sub skipcheck {
Subroutine skipcheck: called CC=15 SCAR=29.6
Pod documented
1200 12155 my($self) = shift;
1201 12155 my($section) = @_;
1202 12155 ▶ return 'skipped' if $section eq 'metafile' && $UNDER_CORE;
Branch: 1 branch
BranchTrueFalseTotal
if $section eq "metafile" and $ExtUtils::MakeMaker::UNDER_CORE 0 12155 12155
Condition66%2/3
$section eq "metafile" and $ExtUtils::MakeMaker::UNDER_CORE
!ll&&!rl&&r
119382170
MC/DC0%0/2
$section eq "metafile" and $ExtUtils::MakeMaker::UNDER_CORE
$section eq "metafile" $ExtUtils::MakeMaker::UNDER_CORE
Truth table66%2/3
A and B
A= $section eq "metafile"B= $ExtUtils::MakeMaker::UNDER_CORE
ABresult
0X0
100
111
1203 12155 ▶ if ($section eq 'dynamic') {
Branch: 1 branch
BranchTrueFalseTotal
if ($section eq "dynamic") 217 11938 12155
1204 print "Warning (non-fatal): Target 'dynamic' depends on targets ",
1205 "in skipped section 'dynamic_bs'\n"
1206 217 ▶ if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"SKIPHASH"}{"dynamic_bs"} and $ExtUtils::MakeMaker::Verbose 0 217 217
Condition33%1/3
$self->{"SKIPHASH"}{"dynamic_bs"} and $ExtUtils::MakeMaker::Verbose
!ll&&!rl&&r
21700
MC/DC0%0/2
$self->{"SKIPHASH"}{"dynamic_bs"} and $ExtUtils::MakeMaker::Verbose
$self->{"SKIPHASH"}{"dynamic_bs"} $ExtUtils::MakeMaker::Verbose
Truth table33%1/3
A and B
A= $self->{"SKIPHASH"}{"dynamic_bs"}B= $ExtUtils::MakeMaker::Verbose
ABresult
0X0
100
111
1207 print "Warning (non-fatal): Target 'dynamic' depends on targets ",
1208 "in skipped section 'dynamic_lib'\n"
1209 217 ▶ if $self->{SKIPHASH}{dynamic_lib} && $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"SKIPHASH"}{"dynamic_lib"} and $ExtUtils::MakeMaker::Verbose 0 217 217
Condition66%2/3
$self->{"SKIPHASH"}{"dynamic_lib"} and $ExtUtils::MakeMaker::Verbose
!ll&&!rl&&r
21520
MC/DC0%0/2
$self->{"SKIPHASH"}{"dynamic_lib"} and $ExtUtils::MakeMaker::Verbose
$self->{"SKIPHASH"}{"dynamic_lib"} $ExtUtils::MakeMaker::Verbose
Truth table66%2/3
A and B
A= $self->{"SKIPHASH"}{"dynamic_lib"}B= $ExtUtils::MakeMaker::Verbose
ABresult
0X0
100
111
1210 }
1211 12155 ▶ if ($section eq 'dynamic_lib') {
Branch: 1 branch
BranchTrueFalseTotal
if ($section eq "dynamic_lib") 217 11938 12155
1212 print "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ",
1213 "targets in skipped section 'dynamic_bs'\n"
1214 217 ▶ if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"SKIPHASH"}{"dynamic_bs"} and $ExtUtils::MakeMaker::Verbose 0 217 217
Condition33%1/3
$self->{"SKIPHASH"}{"dynamic_bs"} and $ExtUtils::MakeMaker::Verbose
!ll&&!rl&&r
21700
MC/DC0%0/2
$self->{"SKIPHASH"}{"dynamic_bs"} and $ExtUtils::MakeMaker::Verbose
$self->{"SKIPHASH"}{"dynamic_bs"} $ExtUtils::MakeMaker::Verbose
Truth table33%1/3
A and B
A= $self->{"SKIPHASH"}{"dynamic_bs"}B= $ExtUtils::MakeMaker::Verbose
ABresult
0X0
100
111
1215 }
1216 12155 ▶ if ($section eq 'static') {
Branch: 1 branch
BranchTrueFalseTotal
if ($section eq "static") 217 11938 12155
1217 print "Warning (non-fatal): Target 'static' depends on targets ",
1218 "in skipped section 'static_lib'\n"
1219 217 ▶ if $self->{SKIPHASH}{static_lib} && $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"SKIPHASH"}{"static_lib"} and $ExtUtils::MakeMaker::Verbose 0 217 217
Condition66%2/3
$self->{"SKIPHASH"}{"static_lib"} and $ExtUtils::MakeMaker::Verbose
!ll&&!rl&&r
21520
MC/DC0%0/2
$self->{"SKIPHASH"}{"static_lib"} and $ExtUtils::MakeMaker::Verbose
$self->{"SKIPHASH"}{"static_lib"} $ExtUtils::MakeMaker::Verbose
Truth table66%2/3
A and B
A= $self->{"SKIPHASH"}{"static_lib"}B= $ExtUtils::MakeMaker::Verbose
ABresult
0X0
100
111
1220 }
1221 12155 ▶ return 'skipped' if $self->{SKIPHASH}{$section};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"SKIPHASH"}{$section} 564 11591 12155
1222 11591 return '';
1223 }
1224  
1225 # returns filehandle, dies on fail. :raw so no :crlf
1226 214 ▶sub open_for_writing {
Subroutine open_for_writing: called CC=3 SCAR=11.2
Pod undocumented
1227 214 my ($file) = @_;
1228 214 ▶ open my $fh ,">", $file or die "Unable to open $file: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $file or die "Unable to open ${file}: $!" 214 0 214
1229 214 my @layers = ':raw';
1230 214 ▶ push @layers, join ' ', ':encoding(locale)' if $CAN_DECODE;
Branch: 1 branch
BranchTrueFalseTotal
if $CAN_DECODE 214 0 214
1231 214 binmode $fh, join ' ', @layers;
1232 214 $fh;
1233 }
1234  
1235 214 ▶sub flush {
Subroutine flush: called CC=12 SCAR=25.0
Pod undocumented
1236 214 my $self = shift;
1237  
1238 214 my $finalname = $self->{MAKEFILE};
1239 214 ▶ printf STDOUT "Generating a %s %s\n", $self->make_type, $finalname if $Verbose || !$self->{PARENT};
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose or not $self->{"PARENT"} 135 79 214
Condition66%2/3
$ExtUtils::MakeMaker::Verbose or not $self->{"PARENT"}
l!l&&r!l&&!r
013579
MC/DC50%1/2
$ExtUtils::MakeMaker::Verbose or not $self->{"PARENT"}
$ExtUtils::MakeMaker::Verbose not $self->{"PARENT"}
Truth table66%2/3
A or not(B)
A= $ExtUtils::MakeMaker::VerboseB= not $self->{"PARENT"}
ABresult
1X1
011
000
1240 214 ▶ print STDOUT "Writing $finalname for $self->{NAME}\n" if $Verbose || !$self->{PARENT};
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::Verbose or not $self->{"PARENT"} 135 79 214
Condition66%2/3
$ExtUtils::MakeMaker::Verbose or not $self->{"PARENT"}
l!l&&r!l&&!r
013579
MC/DC50%1/2
$ExtUtils::MakeMaker::Verbose or not $self->{"PARENT"}
$ExtUtils::MakeMaker::Verbose not $self->{"PARENT"}
Truth table66%2/3
A or not(B)
A= $ExtUtils::MakeMaker::VerboseB= not $self->{"PARENT"}
ABresult
1X1
011
000
1241  
1242 214 ▶ unlink($finalname, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ());
Branch: 1 branch
BranchTrueFalseTotal
$Is_VMS ? : 0 214 214
1243  
1244 214 write_file_via_tmp($finalname, $self->{RESULT});
1245  
1246 # Write MYMETA.yml to communicate metadata up to the CPAN clients
1247 print STDOUT "Writing MYMETA.yml and MYMETA.json\n"
1248 214 ▶ if !$self->{NO_MYMETA} and $self->write_mymeta( $self->mymeta );
Branch: 1 branch
BranchTrueFalseTotal
if not $self->{"NO_MYMETA"} and $self->write_mymeta($self->mymeta) 185 29 214
Condition100%3/3
not $self->{"NO_MYMETA"} and $self->write_mymeta($self->mymeta)
!ll&&!rl&&r
128185
MC/DC100%2/2
not $self->{"NO_MYMETA"} and $self->write_mymeta($self->mymeta)
not $self->{"NO_MYMETA"} $self->write_mymeta($self->mymeta)
Truth table100%3/3
not(A) and B
A= not $self->{"NO_MYMETA"}B= $self->write_mymeta($self->mymeta)
ABresult
0X0
100
111
1249  
1250 # save memory
1251 214 ▶ if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PARENT"} and not $self->{"_KEEP_AFTER_FLUSH"}) 9 205 214
Condition100%3/3
$self->{"PARENT"} and not $self->{"_KEEP_AFTER_FLUSH"}
!ll&&!rl&&r
135709
MC/DC100%2/2
$self->{"PARENT"} and not $self->{"_KEEP_AFTER_FLUSH"}
$self->{"PARENT"} not $self->{"_KEEP_AFTER_FLUSH"}
Truth table100%3/3
A and not(B)
A= $self->{"PARENT"}B= not $self->{"_KEEP_AFTER_FLUSH"}
ABresult
0X0
100
111
1252 9 my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE);
1253 9 delete $self->{$_} for grep !$keep{$_}, keys %$self;
1254 }
1255  
1256 system("$Config::Config{eunicefix} $finalname")
1257 214 ▶ if $Config::Config{eunicefix} ne ":";
Branch: 1 branch
BranchTrueFalseTotal
if $Config::Config{"eunicefix"} ne ":" 0 214 214
1258  
1259 214 return;
1260 }
1261  
1262 214 ▶sub write_file_via_tmp {
Subroutine write_file_via_tmp: called CC=10 SCAR=25.6
Pod undocumented
1263 214 my ($finalname, $contents) = @_;
1264 214 my $fh = open_for_writing("MakeMaker.tmp");
1265 214 ▶ die "write_file_via_tmp: 2nd arg must be ref" unless ref $contents;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $contents 0 214 214
1266 214 for my $chunk (@$contents) {
1267 25550 my $to_write = $chunk;
1268 25550 ▶ $to_write = '' unless defined $to_write;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $to_write 0 25550 25550
1269 25550 ▶ utf8::encode $to_write if !$CAN_DECODE && "$]" > 5.008;
Branch: 1 branch
BranchTrueFalseTotal
if not $CAN_DECODE and "$]" > "5.008" 0 25550 25550
Condition33%1/3
not $CAN_DECODE and "$]" > "5.008"
!ll&&!rl&&r
2555000
MC/DC0%0/2
not $CAN_DECODE and "$]" > "5.008"
not $CAN_DECODE "$]" > "5.008"
Truth table33%1/3
not(A) and B
A= not $CAN_DECODEB= "$]" > "5.008"
ABresult
0X0
100
111
1270 25550 ▶ print $fh "$to_write\n" or die "Can't write to MakeMaker.tmp: $!";
Branch: 1 branch
BranchTrueFalseTotal
print $fh "$to_write\n" or die "Can't write to MakeMaker.tmp: $!" 25550 0 25550
1271 }
1272 214 ▶ close $fh or die "Can't write to MakeMaker.tmp: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die "Can't write to MakeMaker.tmp: $!" 214 0 214
1273 214 ▶ _rename("MakeMaker.tmp", $finalname) or
Branch: 1 branch
BranchTrueFalseTotal
_rename("MakeMaker.tmp", $finalname) or warn "rename MakeMaker.tmp => ${finalname}: $!" 214 0 214
1274 warn "rename MakeMaker.tmp => $finalname: $!";
1275 214 ▶ chmod 0644, $finalname if !$Is_VMS;
Branch: 1 branch
BranchTrueFalseTotal
unless $Is_VMS 214 0 214
1276 214 return;
1277 }
1278  
1279 # This is a rename for OS's where the target must be unlinked first.
1280 214 ▶sub _rename {
Subroutine _rename: called CC=1 SCAR=0.0
1281 214 my($src, $dest) = @_;
1282 214 _unlink($dest);
1283 214 return rename $src, $dest;
1284 }
1285  
1286 # This is an unlink for OS's where the target must be writable first.
1287 214 ▶sub _unlink {
Subroutine _unlink: called CC=1 SCAR=0.0
1288 214 my @files = @_;
1289 214 chmod 0666, @files;
1290 214 return unlink @files;
1291 }
1292  
1293  
1294 # The following mkbootstrap() is only for installations that are calling
1295 # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker
1296 # writes Makefiles, that use ExtUtils::Mkbootstrap directly.
1297 0 ▶sub mkbootstrap {
Subroutine mkbootstrap: not called CC=1 SCAR=6.9
Pod undocumented
1298 0 die <<END;
1299 !!! Your Makefile has been built such a long time ago, !!!
1300 !!! that is unlikely to work with current MakeMaker. !!!
1301 !!! Please rebuild your Makefile !!!
1302 END
1303 }
1304  
1305 # Ditto for mksymlists() as of MakeMaker 5.17
1306 0 ▶sub mksymlists {
Subroutine mksymlists: not called CC=1 SCAR=6.9
Pod undocumented
1307 0 die <<END;
1308 !!! Your Makefile has been built such a long time ago, !!!
1309 !!! that is unlikely to work with current MakeMaker. !!!
1310 !!! Please rebuild your Makefile !!!
1311 END
1312 }
1313  
1314 1882 ▶sub neatvalue {
Subroutine neatvalue: called CC=8 SCAR=20.8
Pod undocumented
1315 1882 my($v) = @_;
1316 1882 ▶ return "undef" unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 8 1874 1882
1317 1874 my($t) = ref $v;
1318 1874 ▶ return "q[$v]" unless $t;
Branch: 1 branch
BranchTrueFalseTotal
unless $t 679 1195 1874
1319 1195 ▶ if ($t eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if ($t eq "ARRAY") 295 900 1195
1320 295 my(@m, @neat);
1321 295 push @m, "[";
1322 295 foreach my $elem (@$v) {
1323 106 push @neat, "q[$elem]";
1324 }
1325 295 push @m, join ", ", @neat;
1326 295 push @m, "]";
1327 295 return join "", @m;
1328 }
1329 900 ▶ return $v unless $t eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless $t eq "HASH" 5 895 900
1330 895 my(@m, $key, $val);
1331 895 for my $key (sort keys %$v) {
1332 124 ▶ last unless defined $key; # cautious programming in case (undef,undef) is true
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 124 124
1333 124 push @m,"$key=>".neatvalue($v->{$key});
1334 }
1335 895 return "{ ".join(', ',@m)." }";
1336 }
1337  
1338 217 ▶sub selfdocument {
Subroutine selfdocument: called CC=5 SCAR=24.7
Pod undocumented
1339 217 my($self) = @_;
1340 217 my(@m);
1341 217 ▶ if ($Verbose){
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::MakeMaker::Verbose) 0 217 217
1342 0 push @m, "\n# Full list of MakeMaker attribute values:";
1343 0 foreach my $key (sort keys %$self){
1344 0 ▶ next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "RESULT" or $key =~ /^[A-Z][a-z]/ 0 0 0
Condition0%0/3
$key eq "RESULT" or $key =~ /^[A-Z][a-z]/
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "RESULT" or $key =~ /^[A-Z][a-z]/
$key eq "RESULT" $key =~ /^[A-Z][a-z]/
Truth table0%0/3
A or B
A= $key eq "RESULT"B= $key =~ /^[A-Z][a-z]/
ABresult
1X1
011
000
1345 0 my($v) = neatvalue($self->{$key});
1346 0 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
1347 0 $v =~ tr/\n/ /s;
1348 0 push @m, "# $key => $v";
1349 }
1350 }
1351 # added here as selfdocument is not overridable
1352 217 push @m, <<'EOF';
1353  
1354 # here so even if top_targets is overridden, these will still be defined
1355 # gmake will silently still work if any are .PHONY-ed but nmake won't
1356 EOF
1357 push @m, join "\n", map "$_ ::\n\t\$(NOECHO) \$(NOOP)\n",
1358 qw(test_static test_dynamic),
1359 # config is so manifypods won't puke if no subdirs
1360 217 grep !$self->{SKIPHASH}{$_},
1361 qw(static dynamic config);
1362 217 join "\n", @m;
1363 }
1364  
1365 96 1;
1366  
1367 __END__
« lib/ExtUtils/MM_Unix.pm ↑ Summary lib/ExtUtils/Command/MM.pm »