Installing Local Perl Modules with CPAN
CPAN is a convenient way to build and install perl modules, but many people have difficulty knowing how to do this if they lack "root" permissions. This tutorial will demonstrate how to install Perl modules to a local user space using CPAN.
First start the CPAN shell:
1 2 3 4 5 6 7 8 9
Next determine where you want to install your local Perl modules. Let's assume we are going to place them in: /mnt/home/myUid/perlmods
Now from within the CPAN shell, enter the following three (3) commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
If you want to make the settings above permanent, enter "o conf commit". Otherwise, bear in-mind you will need to reset this value every time you restart CPAN. If you do make the setting permanent, you can always change it later and re-commit as shown above.
Now to install a module (lets assume we want to build "Math::GMP") simply enter:
Respond to any prompts for information that might be requested. When you are finished, enter:
Setting the PERL5LIB Path
Now that you've successfully installed a local Perl module, you will need to tell Perl where to find them. This can be easily accomplished by setting the environmental path variable "PERL5LIB". For example:
You can add this export to your .bashrc file if you'd like to ensure it is always loaded upon login. In addition, for any scripts that you write that utilize these local Perl modules that you run on the HPCC cluster, you should add this export statement to your job script, or create a custom user module that does that for you, and which can be loaded from within your job script.