lib/ExtUtils/MakeMaker.pm

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