Skip to content

Commit d4c10a4

Browse files
committed
Reorder into setup, extract, check, generate
1 parent 4223894 commit d4c10a4

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
@@ -421,44 +421,35 @@ sub new {
421421
} else {
422422
$self = {};
423423
}
424-
425424
setup_MY($self, ++$PACKNAME); # blesses
426425

426+
$self->extract_hints;
427+
local @Parent = @Parent; # Protect against non-local exits
428+
$self->extract_PARENT;
429+
$self->extract_ARGV(\@ARGV);
430+
$self->{NAME} ||= $self->guess_name;
431+
warn "Warning: NAME must be a package name\n"
432+
unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!;
433+
($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
434+
427435
# Cleanup all the module requirement bits
428436
my $cmrstash = $self->clean_versions;
429-
430437
$self->_PREREQ_PRINT if "@ARGV" =~ /\bPREREQ_PRINT\b/;
431438
$self->_PRINT_PREREQ if "@ARGV" =~ /\bPRINT_PREREQ\b/; # RedHatism.
432-
433439
if (-f "MANIFEST" && ! -f "Makefile" && ! $ENV{PERL_CORE}) {
434440
check_manifest();
435441
}
436-
437-
$self->extract_hints;
438-
439442
$self->check_min_perl_version;
440443
my $unsatisfied_prereqs = $self->check_prereqs($cmrstash);
441-
my ($initial_att, $configure_att) = $self->extract_CONFIGURE;
442-
443-
local @Parent = @Parent; # Protect against non-local exits
444-
$self->extract_PARENT;
445-
446-
$self->extract_ARGV(\@ARGV);
447-
448444
$self->check_PREREQ_FATAL($unsatisfied_prereqs); # after ARGV processed
449-
450-
$self->{NAME} ||= $self->guess_name;
451-
warn "Warning: NAME must be a package name\n"
452-
unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!;
453-
($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
454-
455-
for my $method (@init_methods) { $self->$method }
456-
445+
# CONFIGURE after PREREQ_FATAL so can rely on prereqs being present
446+
my ($initial_att, $configure_att) = $self->extract_CONFIGURE;
457447
$self->arch_check(
458448
$INC{'Config.pm'},
459449
File::Spec->catfile($Config{'archlibexp'}, "Config.pm")
460450
);
461451

452+
for my $method (@init_methods) { $self->$method }
462453
$self->makefile_preamble(\@ARGV, $initial_att, $configure_att);
463454
$self->generate_makefile;
464455

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)