From cb102c57c3a9f4697086bd40bd1425c3ea7b36ef Mon Sep 17 00:00:00 2001 From: wu-lee Date: Fri, 13 Nov 2015 12:09:01 +0000 Subject: [PATCH] Module/Release/Prereq.pm - check makefile_PL configuration, and use Test::Prereq::Build if appropriate --- lib/Module/Release.pm | 4 ++++ lib/Module/Release/Prereq.pm | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/Module/Release.pm b/lib/Module/Release.pm index 60e5d16..53dc017 100644 --- a/lib/Module/Release.pm +++ b/lib/Module/Release.pm @@ -101,6 +101,10 @@ The name of the file to run as F. The default is C<"Makefile.PL">, but you can set it to C<"Build.PL"> to use a C-based system. +If this is set to C<"Build.PL">, this his will also cause +C to use C instead of +C. + =item makefile The name of the file created by C above. The default is diff --git a/lib/Module/Release/Prereq.pm b/lib/Module/Release/Prereq.pm index 108130f..2ccf6ef 100644 --- a/lib/Module/Release/Prereq.pm +++ b/lib/Module/Release/Prereq.pm @@ -34,19 +34,29 @@ It looks in local_name to get the name of the distribution file. =cut + +my %Prereq_modules = ( + '' => 'Test::Prereq', + 'Makefile.PL' => 'Test::Prereq', + 'Build.PL' => 'Test::Prereq::Build', +); + sub check_prereqs { - eval "require Test::Prereq; 1 " or - $_[0]->_die( "You need Test::Prereq to check prereqs" ); + my $prereqs_type = $_[0]->config->makefile_PL; + my $test_prereqs = $Prereq_modules{$prereqs_type} || 'Test::Prereq'; + + eval "require $test_prereqs; 1 " or + $_[0]->_die( "You need $test_prereqs to check prereqs" ); - $_[0]->_print( "Checking prereqs... " ); + $_[0]->_print( "Checking prereqs with $test_prereqs... " ); my $perl = $_[0]->{perl}; my @ignore = $_[0]->_get_prereq_ignore_list; my $messages = $_[0]->run( - qq|$perl -MTest::Prereq -e "prereq_ok( undef, undef, [ qw(@ignore) ] )"| + qq|$perl -M$test_prereqs -e "prereq_ok( undef, undef, [ qw(@ignore) ] )"| ); $_[0]->_die( "Prereqs had a problem:\n$messages\n" )