Skip Menu |

This queue is for tickets about the ExtUtils-MakeMaker CPAN distribution.

Report information
The Basics
Id: 58340
Status: new
Priority: 0/
Queue: ExtUtils-MakeMaker

Owner: Nobody in particular
Requestors: JUSTER [...]

Bug Information
Severity: Normal
Broken in:
  • 6.55_02
  • 6.56
Fixed in: (no value)

Subject: $ENV{PERL_MM_OPT} params overrides WriteMakefile() params
Hello, I am using perl 5.10.1 on Linux (archlinux). I have proven my problem occurs with ExtUtils::MakeMaker 6.55_02 and 6.56. When you specify parameters with the PERL_MM_OPT environment variable it overrides any parameters you give to WriteMakefile(). This also means the PERL_MM_OPT environment variable overrides parameters given on the command-line to Makefile.PL. I am not sure this is intentional but this seems counter intuitive to me. Any automated building should also be sure to unset the PERL_MM_OPT environment variable, or else command line parameters could be ignored. I found this problem when one of Module::Install's test failed. The test will fail if you set the INSTALLDIRS parameter with PERL_MM_OPT. I am not sure whether I should report here or at Module::Install's RT. I figured I should report here first. Attached is a short script file that can be used with 'prove' to prove that the problem exists in MakeMaker. This script uses ExtUtils::MakeMaker and Test::More. Thanks for any help, Justin Davis
text/x-perl 1.3k
#!/usr/bin/perl use warnings; use strict; use ExtUtils::MakeMaker; use Test::More; # Returns the file contents as a list. sub lines_of { my ($filename) = @_; open my $fh, '<', $filename or die "open on $filename: $!"; return <$fh>; } # Returns the value of the given variable name in the Makefile. sub make_var { my ($var_name) = @_; my ($id_line) = grep { /^$var_name/ } lines_of( 'Makefile' ); my ($value) = $id_line =~ /^$var_name = (.*)/; return $value; } # Takes a hash as argument: # * Keys are MM command-line parameters # * Values is an arrayref # - Index 0 is the parameter value stored in PERL_MM_OPT env. variable # - Index 1 is the parameter value passed to WriteMakefile() # # Our test fails if the value of index 1 is not present in the Makefile # as the given parameter's value. sub test_mm_opt { my (%mm_opts) = @_; local $ENV{'PERL_MM_OPT'} = join q{ }, map { "$_=$mm_opts{$_}[0]" } keys %mm_opts; WriteMakefile( NAME => 'Test', map { $_ => $mm_opts{$_}[1] } keys %mm_opts ); for my $var_name ( keys %mm_opts ) { is make_var( $var_name ) => $mm_opts{ $var_name }[1], "$var_name is not overriden by PERL_MM_OPT"; } unlink 'Makefile'; } test_mm_opt( 'INSTALL_BASE' => [ qw{ /tmp /foo/bar } ] ); test_mm_opt( 'INSTALLDIRS' => [ qw/ vendor site / ] ); done_testing();

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to