1

I'd like to use a home directory specific, non-root directory for stuff I install from cpan. How can I configure it?

Normal CPAN configuration tries to install packages into /usr. After adding 'makepl_arg' => q[PREFIX=~/cpan_local], simple packages seem to build, but I cannot build a package that pulls its dependencies - the dependency is not found.

After I changed it to 'makepl_arg' => q[PREFIX=~/cpan_local LIB=~/cpan_local], I get the following message: Warning: Prerequisite 'ExtUtils::CBuilder => 0.27' for 'D/DA/DAGOLDEN/Module-Build-0.3607.tar.gz' already installed but installation looks suspicious. Skipping another installation attempt, to prevent looping endlessly.

How can I configure this properly? I want everything that's built to do to ~/cpan_local automatically. (or for people familiar with python, I'd like this to work like virtual-env and running easy_install from it).

viraptor
  • 33,322
  • 10
  • 107
  • 191
  • Duplicate of [How can I install a CPAN module into a local directory?](http://stackoverflow.com/questions/540640/how-can-i-install-a-cpan-module-into-a-local-directory) -- the trick is to use [local::lib](http://search.cpan.org/perldoc?local::lib) which is very well documented. – Ether Aug 18 '10 at 14:32

2 Answers2

5

Even better, install App::cpanminus first. Then just use it to install modules as a regular user. If this user can't write to the /usr/local/lib/perl* directories it will resort to writing in its home directory, or you pass it the -l or --local-lib option to directly install it in your home directory without it figuring out if it can install them system wide.

Finally, installing local::lib and setting up your environment automatically with your .bashrc file will allow you to omit the --local-lib option and install to your home directory directly.

Htbaa
  • 2,319
  • 18
  • 28
2

Use local::lib. The bootstrap instructions should do the trick for you.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335