3

I am trying to setup a directory that contains Perl modules that should be set aside to not interfere with a production system.

This works OK, with modules that use Module::Install. I just specify a "lib" option and all is well. Now I tried and tried and I simply cannot make this happen with Module::Build. For instance, this command:

./Build install --lib /foo

Will install the module in "/foo/share/perl/5.10.0".

How can I get rid off the "share/perl/5.10.0" part?

PS: Yes, I have taken a long look at the documentation and found some promising sections, but I simply must admit that I seem to be too stupid to grok them.

Brad Gilbert
  • 33,846
  • 11
  • 78
  • 129
innaM
  • 47,505
  • 4
  • 67
  • 87
  • Would `local::lib` do the trick? See this question and its answer. (I'm not quite sure it's the same issue, but it may help). http://stackoverflow.com/questions/786544/how-do-i-tell-cpan-pm-to-install-all-modules-in-a-specific-directory – Telemachus Aug 16 '09 at 11:11
  • I guess it would or could do the trick, but it feels like a kludge and I'd rather try to tweak Module::Build first before I try my luck mit local::lib. – innaM Aug 16 '09 at 12:37
  • Now I'm curious more generally: what do you see as the advantage to putting all the libs in one basket (a la Sinan's answer)? Even without this, since all modules would be installed at `/foo/something`, they would still be out of the way of the production system's default libraries, wouldn't they? Unless I'm confused, all you're doing is cutting down on the depth of the `/foo` directory. – Telemachus Aug 16 '09 at 13:55
  • Most of the modules I need are already where I'd like them to be. I'd have to reinstall those or use two addiditional module paths. – innaM Aug 16 '09 at 15:49
  • Is it really worth your time to care about an extra lib/perl5? You're looking to do a lot of extra work to get something that most people won't expect and for no additional benefit. Give in and move on in life to something more important :) – brian d foy Aug 16 '09 at 15:59
  • Oh, come on. 10 minutes ain't that bad. God knows how often I will have to type that "lib/perl5" string, which in reality, will be a lot longer (sun-solaris/perl5/lib/5.8.8). – innaM Aug 16 '09 at 18:14

2 Answers2

3

See install_path. It looks like (I haven't tried) you can either put in .modulebuildrc or specify on the command line all of the path options:

./Build install --install_base $CUSTOMPERLSTUFF \
                --install_path lib=$CUSTOMPERLSTUFF/lib \
                --install_path arch=$CUSTOMPERLSTUFF/lib 
Brad Gilbert
  • 33,846
  • 11
  • 78
  • 129
Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • 1
    That did the trick! I really needed to provide all three arguments and I'm still not sure how you were able to distill that out of the documentation. But it works! Thank you. – innaM Aug 16 '09 at 13:24
  • Is there any way to make this the default behaviour? – ajwood Mar 24 '11 at 17:49
0

I think your best chance is with install_base. From the doc:

install_base

You can also set the whole bunch of installation paths by supplying the install_base parameter to point to a directory on your system. For instance, if you set install_base to "/home/ken" on a Linux system, you'll install as follows:

  lib     => /home/ken/lib/perl5
  arch    => /home/ken/lib/perl5/i386-linux
  script  => /home/ken/bin
  bin     => /home/ken/bin
  bindoc  => /home/ken/man/man1
  libdoc  => /home/ken/man/man3
  binhtml => /home/ken/html
  libhtml => /home/ken/html
Community
  • 1
  • 1