Skip to content

Commit e4fca3c

Browse files
committed
Reorder into setup, extract, check, generate
1 parent f5e142c commit e4fca3c

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

lib/ExtUtils/MakeMaker.pm

+12-21
Original file line numberDiff line numberDiff line change
@@ -432,44 +432,35 @@ sub new {
432432
} else {
433433
$self = {};
434434
}
435-
436435
setup_MY($self, ++$PACKNAME); # blesses
437436

437+
$self->extract_hints;
438+
local @Parent = @Parent; # Protect against non-local exits
439+
$self->extract_PARENT;
440+
$self->extract_ARGV(\@ARGV);
441+
$self->{NAME} ||= $self->guess_name;
442+
warn "Warning: NAME must be a package name\n"
443+
unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!;
444+
($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
445+
438446
# Cleanup all the module requirement bits
439447
my $cmrstash = $self->clean_versions;
440-
441448
$self->_PREREQ_PRINT if "@ARGV" =~ /\bPREREQ_PRINT\b/;
442449
$self->_PRINT_PREREQ if "@ARGV" =~ /\bPRINT_PREREQ\b/; # RedHatism.
443-
444450
if (-f "MANIFEST" && ! -f "Makefile" && ! $ENV{PERL_CORE}) {
445451
check_manifest();
446452
}
447-
448-
$self->extract_hints;
449-
450453
$self->check_min_perl_version;
451454
my $unsatisfied_prereqs = $self->check_prereqs($cmrstash);
452-
my ($initial_att, $configure_att) = $self->extract_CONFIGURE;
453-
454-
local @Parent = @Parent; # Protect against non-local exits
455-
$self->extract_PARENT;
456-
457-
$self->extract_ARGV(\@ARGV);
458-
459455
$self->check_PREREQ_FATAL($unsatisfied_prereqs); # after ARGV processed
460-
461-
$self->{NAME} ||= $self->guess_name;
462-
warn "Warning: NAME must be a package name\n"
463-
unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!;
464-
($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
465-
466-
for my $method (@init_methods) { $self->$method }
467-
456+
# CONFIGURE after PREREQ_FATAL so can rely on prereqs being present
457+
my ($initial_att, $configure_att) = $self->extract_CONFIGURE;
468458
$self->arch_check(
469459
$INC{'Config.pm'},
470460
File::Spec->catfile($Config{'archlibexp'}, "Config.pm")
471461
);
472462

463+
for my $method (@init_methods) { $self->$method }
473464
$self->makefile_preamble(\@ARGV, $initial_att, $configure_att);
474465
$self->generate_makefile;
475466

t/prereq.t

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BEGIN {
99

1010
use strict;
1111
use Config;
12-
use Test::More tests => 19;
12+
use Test::More tests => 18;
1313
use File::Temp qw[tempdir];
1414

1515
use TieOut;
@@ -163,17 +163,14 @@ MakeMaker FATAL: prerequisites not found.
163163
Please install these modules first and rerun 'perl Makefile.PL'.
164164
END
165165

166-
167-
$warnings = '';
166+
# don't care about warnings here, only the die()
168167
@ARGV = 'PREREQ_FATAL=1';
169168
eval {
170169
WriteMakefile(
171170
NAME => 'Big::Dummy',
172171
PREREQ_PM => { "I::Do::Not::Exist" => 0, },
173172
);
174173
};
175-
is $warnings, "Warning: prerequisite I::Do::Not::Exist 0 not found.\n",
176-
'CLI PREREQ_FATAL warns';
177174
isnt $@, '', "CLI PREREQ_FATAL works";
178175

179176
}

0 commit comments

Comments
 (0)