While we provide a number of Perl modules, you may need a module we do not provide. If it is a commonly used module, or one that is particularly difficult to compile, you can contact OSC Help for assistance, but we have provided an example below showing how to build and install your own Perl modules. Note, these instructions use "bash" shell syntax; this is our default shell, but if you are using something else (csh, tcsh, etc), some of the syntax may be different.
CPAN, the Comprehensive Perl Achive Network, is the primary source for publishing and fetching the latest modules and libraries for the Perl programming language. The default method for installing Perl modules using the "CPAN Shell", provides users with a great deal of power and flexibility but at the cost of a complex configuration and inelegant default setup.
Setting Up CPAN Minus
To use CPAN Minus, we must first load it, if it hasn't already been loaded.
module load cpanminus
Next, in order to use cpanminus, you will need to run the following command only ONCE:
perl -I /usr/local/cpanminus/perl5/lib/perl5 -Mlocal::lib
Using CPAN Minus
In most cases, using CPAN Minus to install modules is as simple as issuing a command in the following form:
For example, below are three examples of installing perl modules:
cpanm Math::CDF cpanm SET::IntervalTree cpanm DB_File
Testing Perl Modules
To test a perl module import, here are some examples below:
perl -e "require Math::CDF" perl -e "require Set::IntervallTree" perl -e "require DB_File"
The modules are installed correctly if no output is printed.
What Local Modules are Installed in my Account?
To show the local modules you have installed in your user account:
Reseting Module Collection
If you should ever want to start over with your perl module collection, delete the following folders:
rm -r ~/perl5 rm -r ~/.cpanm