Subject: | Module::Build fails to bootstrap if PREFIX is set in environment |
I have a freshly perlbrew'd 5.22.1, which I activated with 'perlbrew use ...'. I then ran 'cpan Module::Runtime' to install Module::Runtime. Module::Runtime uses Module::Build, so that was built/tested/installed first. Then Module::Runtime failed because Module::Build couldn't be loaded. This confused me.
I then tried to install Module::Build directly, but I noticed that the "make install" step simply built the module without actually installing anything. (WTF?)
I finally noticed that 'make install' skipped the install part because the files already existed at the target location, which was under ~/usr/lib/site_perl/, not under ~/perl5/perlbrew/perls/... (and that install location wasn't in my @INC either). So Module::Build boostrap-installs itself into a wrong location where it can't be found.
As it turns out, I have a PREFIX variable in my environment set to "$HOME/usr". Module::Build::Compat uses that environment variable to set the prefix, which is why it breaks. ExtUtils::MakeMaker ignores that variable, so EUMM based modules install correctly.
I checked the manual and neither Module::Build nor Module::Build::Compat document that the PREFIX environment variable has such a disastrous impact. I checked the ExtUtils::MakeMaker documentation, too, and it says nothing about it, because the generated Makefile ignores the environment variable (it sets its own PREFIX).
Can you make Module::Build stop reading my unrelated environment variables?