Skip to content

Commit f8d9075

Browse files
committed
refactor prereq keys into constant
1 parent 37647a2 commit f8d9075

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/ExtUtils/MakeMaker.pm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ our @EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists
3939
&WriteEmptyMakefile &open_for_writing &write_file_via_tmp
4040
&_sprintf562);
4141

42+
my @PREREQ_KEYS = qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES);
43+
4244
# These will go away once the last of the Win32 & VMS specific code is
4345
# purged.
4446
my $Is_VMS = $^O eq 'VMS';
@@ -444,7 +446,7 @@ sub new {
444446

445447
# Cleanup all the module requirement bits
446448
my %key2cmr;
447-
for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
449+
for my $key (@PREREQ_KEYS) {
448450
$self->{$key} ||= {};
449451
if (_has_cpan_meta_requirements) {
450452
my $cmr = CPAN::Meta::Requirements->from_string_hash(
@@ -551,14 +553,14 @@ END
551553
my $cmr;
552554
if (_has_cpan_meta_requirements) {
553555
$cmr = CPAN::Meta::Requirements->new;
554-
for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
556+
for my $key (@PREREQ_KEYS) {
555557
$cmr->add_requirements($key2cmr{$key}) if $key2cmr{$key};
556558
}
557559
foreach my $prereq ($cmr->required_modules) {
558560
$prereq2version{$prereq} = $cmr->requirements_for_module($prereq);
559561
}
560562
} else {
561-
for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
563+
for my $key (@PREREQ_KEYS) {
562564
next unless my $module2version = $self->{$key};
563565
$prereq2version{$_} = $module2version->{$_} for keys %$module2version;
564566
}

0 commit comments

Comments
 (0)