3

I'm installing a bunch of modules listed in a cpanfile into a self-contained directory:

 cpanm -L bundle --quiet --notest --self-contained --with-recommends --installdeps .

Afterward, all the modules are in bundle/lib/perl5. Which is almost exactly what I want. Is there an incantation to feed cpanm — or an environment variable to set — to get cpanm to tell the installer to put the files in bundle/lib, instead? I assume I'd need to do something to convince ExtUtils::MakeMaker and Module::Build to append a different value to the install_base, but I haven't been able to figure out how.

theory
  • 9,178
  • 10
  • 59
  • 129
  • It sounds like you have `local::lib` installed to `bundle/lib/perl5`? – Borodin Aug 17 '18 at 20:19
  • I'm passing `-L bundle`, which builds things as if local::lib is set to `bundle`. It installs modules in `bundle/lib/perl5`, I think, because `$Config{installstyle}` is set to `lib/perl5` and not `lib` — and that's true regardless of what local::lib is set to use. – theory Aug 17 '18 at 20:59

1 Answers1

2

Trolling through the Module::Build source, it looks like it's not possible to install modules without the perl5 part of the directory — at least not when using install_base (which cpanm's --self-contained implies). Judging from the comment, it appears that the decision was made to be consistent about always installing in lib/perl5 when using install_base, so as to keep things as predictable as possible. It looks like MakeMaker has it hard-coded, too.

theory
  • 9,178
  • 10
  • 59
  • 129