-
Notifications
You must be signed in to change notification settings - Fork 602
Description
Consider this section of dist/Module-CoreList/Makefile.PL:
6 my @extra;
7 push @extra, 'INSTALLDIRS' => 'perl' if $] >= 5.008009 and $] < 5.012;
8
9 push @extra, 'META_MERGE' => {
10 resources => {
11 repository => 'https://github.com/Perl/perl5.git',
12 bugtracker => 'https://github.com/Perl/perl5/issues',
13 homepage => "http://dev.perl.org/",
14 },
15 } unless $ExtUtils::MakeMaker::VERSION < 6.46;
16
17
18 WriteMakefile
19 (
20 'NAME' => 'Module::CoreList',
21 'VERSION_FROM' => 'lib/Module/CoreList.pm',
22 'ABSTRACT_FROM' => 'lib/Module/CoreList.pod',
23 'PREREQ_PM' => {
24 'Test::More' => '0',
25 'List::Util' => 0,
26 'version' => 0.88,
27 },
28 'EXE_FILES' => [ _scripts() ],
29 'INSTALLDIRS' => ($] < 5.011 ? 'perl' : 'site'),
30 'PL_FILES' => {},
31 LICENSE => 'perl',
32 @extra,
33 )
34 ;
Note that the INSTALLDIRS key-value pair is potentially assigned to twice, once at line 7 (and by implication at line 32) and once at line 29. While I think that this ultimately DTRT, it's confusing.
Let's say that I simplify this Makefile.PL a bit to:
$ cat reduced-module-corelist-Makefile.PL
use ExtUtils::MakeMaker;
use strict;
use warnings;
my @extra;
push @extra, 'INSTALLDIRS' => 'perl' if $] >= 5.008009 and $] < 5.012;
push @extra, 'META_MERGE' => {
resources => {
repository => 'https://github.com/Perl/perl5.git',
bugtracker => 'https://github.com/Perl/perl5/issues',
homepage => "http://dev.perl.org/",
},
} unless $ExtUtils::MakeMaker::VERSION < 6.46;
my @args = (
'NAME' => 'Module::CoreList',
'VERSION_FROM' => 'lib/Module/CoreList.pm',
'ABSTRACT_FROM' => 'lib/Module/CoreList.pod',
'PREREQ_PM' => {
'Test::More' => '0',
'List::Util' => 0,
'version' => 0.88,
},
'INSTALLDIRS' => ($] < 5.011 ? 'perl' : 'site'),
'PL_FILES' => {},
LICENSE => 'perl',
@extra,
);
use Data::Dumper;
print STDERR Dumper(\@args);
1;
Let's run this program with two different versions of perl: 5.10.1 and 5.42.0 (both built via perlbrew).
$ perlbrew use perl-5.10.1
$ perl reduced-module-corelist-Makefile.PL 2>5.10.1.module-corelist-args.pl
$ perlbrew use perl-5.42.0
$ perl reduced-module-corelist-Makefile.PL 2>5.42.0.module-corelist-args.pl
Examine:
$ vi 5.10.1.module-corelist-args.pl
2 $VAR1 = [
3 'NAME',
4 'Module::CoreList',
...
15 'INSTALLDIRS',
16 'perl',
17 'PL_FILES',
18 {},
19 'LICENSE',
20 'perl',
21 'INSTALLDIRS',
22 'perl',
...
Compare lines 15-16 and 21-22 above.
$ vi 5.42.0.module-corelist-args.pl
1 $VAR1 = [
2 'NAME',
3 'Module::CoreList',
...
14 'INSTALLDIRS',
15 'site',
...
(This stands out better with vimdiff.)
Module::CoreList is maintained in blead but periodically released to CPAN. In principle, it can be installed on perls at least as old as perl-5.8. I don't have any evidence that it's getting installed incorrectly, but this might be confusing to someone maintaining the library in the future.