The Perl modules available from the module system already contain a lot of built-in libraries, but if you need to install additional libraries, you can do this in your home directory.
In order to install Perl libraries to a custom location (in the following example we use $HOME/perl5
), you first have to load a Perl version and install a Perl module named local::lib
:
module load Perl cpanm --local-lib=~/perl5 local::lib
Now you need to instruct Perl where the custom/local modules will be found:
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
Since you need to do this for every login, you may want to add that line to the special file ~/.bashrc
, so that it gets run automatically when you log in:
echo 'eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)' >> ~/.bashrc
Finally, install the module that you need, e.g.:
cpanm name::of::module