Perl and Modules
Install the latest version of Perl if you are unable to install Perl modules using the existing Perl installed in HPC. Else you can just install the modules in your home directory.
Installing Perl
The process is similar to Configure-Make-MakeInstall as described in the section above. The version of perl can be different so change the download link and version accordingly.
wget http://www.cpan.org/src/5.0/perl-5.18.2.tar.gz
tar -xzf perl-5.18.2.tar.gz
cd perl-5.18.2
./Configure -des -Dprefix=$HOME/<perl-directory>
make
make test
make install
(Note: It is a capital C in Configure)
Add the following lines in your .bashrc file as mentioned in the section above.
PATH=$PATH:/home/<CaseID>/perl/5.18.2/bin
PERL5LIB=$PATH:/home/<CaseID>/perl/5.18.2/lib
Installing Perl Module
Even if using the system perl, $PERL5LIB needs to be managed to reflect these local modules
Method 1: Configure CPAN
Modules may installed in your home directory tree to extend the local perl install capabilities. We have found the following modifications to be useful. Be sure to update/export the $PERL5LIB environment variable to reflect the installed location of these modules.
The key is establishing the PREFIX value in the .cpan configuration file. The first time that you use cpan on the cluster, it creates the ~/.cpan/CPAN directory, and that's all that lines 2 and 3 above accomplish. If you've already used cpan, and have ~/.cpan in your /home, then install the modules via cpan should work fine without any elevated privileges.
Summary of commands:
export PERL5OPT="-I${HOME}/.usr/local/perl/lib/perl5 -I${HOME}/.usr/local/perl/lib/perl5/site_perl"
cpan # enter yes at auto config prompt
exit # exit cpan shell
vi .cpan/CPAN/MyConfig.pm # edit line 'makepl_arg' => q[] to 'makepl_arg' => q[PREFIX=~/.usr/local/perl],
cpan
install JSON # Enter "y" at the warning
Configuration details are found in ~/.cpan/CPAN/MyConfig.pm
When this file is first generated, it holds paths consistent with the active shell environment. When building local modules, it's important to update the configuration file to reflect the version of perl to be used with the local modules. Manual edits of ../MyConfig.pm or updates from within cpan will work:
perl -MCPAN -e shell
cpan> o config makepl_arg=/home/<caseid>/.usr/local/perl
Method 2: Specify Install Prefix to Makefile.pl
On Rider/Markov, there is no explicit perl module. A perl more recent than the OS is available as part of the base module. If using the 'base' version of perl, then:
module load base
else confirm that you are using the system perl:
[hpc4 ~]$ which perl
/usr/bin/perl
[hpc4 ~]$ perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux- thread-multi
(with 40 registered patches, see perl -V for more detail)
Install the Perl module:
Call the CPAN with a right version of perl
perl<version> -MCPAN -e shell
Install the required module
>install <Module>[::<SUBMODULE]
For an example, to install the Statistics moudle, Multtest, it is install Statistics::Multtest.
If the installation does not go through, install the modules manually as showed:
perl<version> Makefile.PL PREFIX=$HOME/<perl-directory>; make; make test; make install
If the tests are failing and need to force install
>force install <Module>[::<SUBMODULE]
Method 3: Use Cpan Minus
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.bash_profile
echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.bash_profile
Install modules
cpanm Module::Name