Setting up a local cpan using cpanminus without root accessPosted on December 17, 2012
When asked why colleagues do not use perl modules in their work, often the response is that they do not know how to install them without having root access to the server they are working on. Cpan can be configured to install to a different base directory, however this requires a number of options to be set correctly, and can be a pain to get set up.
However using cpan minus and the local::lib module makes this process as painless as running three simple commands, easy enough to set up for just about anyone. Note that I turn off testing in the following commands, which I encourage you to do as well, I have found there are some false positive failures, and it will save time as well.
First you have to download cpanminus and install it and the local::lib module, change /foo to the directory you would like to install the modules to
Then use the local::lib package to set up the required environment variables to point to your new module path for the current login session
Finally add that command to a login script for your shell so it will be run automatically when you login, i.e. (.profile, .bash_profile, .zshenv) ect.
I also like to set a default –notest, so I don’t have to test every module I install
Then you can then install a module in the correct directory , e.g. the Statistics::Descriptive package, with
It doesn’t get much easier than that!