Subject: | Hard dependency on ExtUtils::AutoInstall no longer needed in Makefile.PL? |
Hi,
I use cpanm to install File::Stat::Ls. cpanm blocks then fails to install File::Stat::Ls because the Makefile.PL script prompts the user to install ExtUtils::AutoInstall, and cpanm doesn't know to handle prompts to the user.
Most of the automated CPAN install tools now recognize BUILD_REQUIRES in the ExtUtils::MakeMaker block, and will install modules that are found in that hash key.
Using this hash key in EU::MM will also populate the module metadata for MetaCPAN, so users will also be able to see the dependency when browsing the module on MetaCPAN.
I'm not sure if ExtUtils::AutoInstall is a build dependency or a runtime dependency of File::Stat::Ls, I only see it used in Makefile.PL.
I've created a patch that removes the call to ExtUtils::AutoInstall in the BEGIN{} block, and uses a BUILD_REQUIRES key in the EU::MM instead. I've tested the patch using cpanm on my Linux test machine, but it's pretty generic, I can't see any why it would have any issues anywhere else.
Patch with:
patch -p0 < File-Stat-Ls-Makefile.PL.20Nov2013.diff
Thanks,
Brian
Subject: | File-Stat-Ls-Makefile.PL.20Nov2013.diff |
--- Makefile.PL 2005-07-13 07:22:06.000000000 -0700
+++ Makefile.PL 2013-11-20 12:48:02.382169016 -0800
@@ -1,38 +1,16 @@
-# ExtUtils::AutoInstall Bootstrap Code, version 4.
-BEGIN {
- my $p='ExtUtils::AutoInstall';
- my $v=.30;
- eval "use $p $v; 1" or
- ($ENV{PERL_EXTUTILS_AUTOINSTALL} !~
- /--(?:default|skip|testonly)/ and (-t STDIN) or
- eval "use ExtUtils::MakeMaker;
- WriteMakefile('PREREQ_PM'=>{'$p',$v}); 1" and
- exit) and
- print "==> $p $v needed. Install it from CPAN? [Y/n] " and
- <STDIN> !~ /^n/i and
- print "*** Fetching $p\n" and
- do {
- eval {require CPANPLUS; CPANPLUS::install $p};
- eval "use $p $v; 1" or
- eval { require CPAN; CPAN::install $p };
- eval "use $p $v; 1" or
- die "Please install $p $v manually first...\n"
- }
-}
-
use lib 'inc';
+use ExtUtils::MakeMaker;
# pre-install handler; takes $module_name and $version
sub MY::preinstall { return 1; } # return false to skip install
# post-install handler; takes $module_name, $version, and $success
sub MY::postinstall { return 0 }
-use ExtUtils::AutoInstall (
- -version => '0.40',
-);
+
WriteMakefile(
DISTNAME => 'File-Stat-Ls-0.11.tar.gz' ,
ABSTRACT => 'Perl class for converting stat to ls -l format',
NAME => 'File::Stat::Ls' ,
+ BUILD_REQUIRES => {ExtUtils::AutoInstall => 0},
PREREQ_PM => {Test::Harness => 0.1,Test::More => 0.45,},
AUTHOR => 'geotiger2001@yahoo.com' ,
VERSION => 0.11 ,