Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 36998
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: ARISTOTLE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Module::Build::Compat throws perl prereq away
Currently, `create_makefile_pl` contains the following statement: delete $prereq{perl}; That’s just wrong. It should instead translate the prerequisite into a `require` clause in the Makefile.PL; something along the following lines (which I’ve also attached in case RT mangles the patch). Note that this doesn’t do much to parse the more complex version specification syntax that M::B supports, but then, `require` doesn’t either, so it’s not clear to me whether it’s possible to do much better without inordinate amounts of effort. --- Compat.pm.orig 2008-06-22 04:43:16.000000000 +0000 +++ Compat.pm 2008-06-22 04:46:59.000000000 +0000 @@ -125,7 +125,11 @@ %prereq = ( %{$build->requires}, %{$build->build_requires} ); %prereq = map {$_, $prereq{$_}} sort keys %prereq; - delete $prereq{perl}; + my $perl_ver = delete $prereq{perl} || ''; + my $perl_require = ($perl_ver =~ /\A\s*(\d+)\.(\d+)(?:\.(\d+))\s*\z/ + ? sprintf "require %d.%03d.%03d;\n", $1, $2, ($3 || 0) + : ''); + $MM_Args{PREREQ_PM} = \%prereq; $MM_Args{INSTALLDIRS} = $build->installdirs eq 'core' ? 'perl' : $build->installdirs; @@ -139,7 +143,7 @@ $args =~ s/\{(.*)\}/($1)/s; print $fh <<"EOF"; -use ExtUtils::MakeMaker; +${perl_require}use ExtUtils::MakeMaker; WriteMakefile $args; EOF
Subject: Compat.pm.diff
--- Compat.pm.orig 2008-06-22 04:43:16.000000000 +0000 +++ Compat.pm 2008-06-22 04:46:59.000000000 +0000 @@ -125,7 +125,11 @@ %prereq = ( %{$build->requires}, %{$build->build_requires} ); %prereq = map {$_, $prereq{$_}} sort keys %prereq; - delete $prereq{perl}; + my $perl_ver = delete $prereq{perl} || ''; + my $perl_require = ($perl_ver =~ /\A(\d+)\.(\d+)(?:\.(\d+))\z/ + ? sprintf "require %d.%03d.%03d;\n", $1, $2, ($3 || 0) + : ''); + $MM_Args{PREREQ_PM} = \%prereq; $MM_Args{INSTALLDIRS} = $build->installdirs eq 'core' ? 'perl' : $build->installdirs; @@ -139,7 +143,7 @@ $args =~ s/\{(.*)\}/($1)/s; print $fh <<"EOF"; -use ExtUtils::MakeMaker; +${perl_require}use ExtUtils::MakeMaker; WriteMakefile $args; EOF
The code in SVN already handles a perl prereq, see near line 50 in lib/Module/Build/Compat.pm.