You can set up a directory in your shared project space, then add any perl modules there for the entire group to use. NOTE: In this example, 'YourGroupDir' refers to the name of your group's project directory. Most shared project directories will be found in /projects/academic (which we use in this example) but some are in /projects/industry or /projects/academic/courses
vortex1$ module load perl
vortex1$ which cpan
/util/common/perl/5.32.1/bin/cpan
vortex1$
Add to ~/.bash_profile
PROJECTS_PERL_DIR="/projects/academic/YourGroupDir/perl5"
if [ -z "$PERL5LIB" ]
then
# If PERL5LIB wasn't previously defined, set it...
PERL5LIB=${PROJECTS_PERL_DIR}/lib/perl5
else
# ...otherwise, extend it.
PERL5LIB=${PROJECTS_PERL_DIR}/lib/perl5:${PERL5LIB}
fi
MANPATH=$MANPATH:${PROJECTS_PERL_DIR}/man
export PERL5LIB MANPATH
vortex1$ source ~/.bash_profile
vortex1$
Make sure PROJECTS_PERL_DIR is set:
vortex1$ echo ${PROJECTS_PERL_DIR} /projects/academic/YourGroupDir/perl5 vortex1$ vortex1$ mkdir -p "${PROJECTS_PERL_DIR}/lib" "${PROJECTS_PERL_DIR}/man/man{1,3}"
Verify that the projects library path is in the perl @INC now
vortex1$ perl -wle"print for grep /$(echo ${PROJECTS_PERL_DIR} | sed 's/\//\\\//g')/, @INC"
vortex1$ /projects/academic/YourGroupDir/perl5/lib
vortex1$ perl -MCPAN -we 'mkmyconfig'
[...]
Would you like to configure as much as possible automatically? [yes] no
hit enter for all options EXCEPT:
CPAN build and cache directory? [/user/username/.cpan] /projects/academic/YourGroupDir/perl5/.cpan
[optional]
Always try to check and verify signatures if a SIGNATURE file is in
the package and Module::Signature is installed (yes/no)? [no] yes
[optional]
Tar command verbosity level (none or v or vv)? [none] v
[optional]
Verbosity level for loading modules (none or v)? [none] v
[optional]
Verbosity level for PERL5LIB changes (none or v)? [none] v
Parameters for the 'perl Makefile.PL' command? [] INSTALL_BASE=/projects/academic/YourGroupDir/perl5
Parameters for the 'perl Build.PL' command? [] --install_base /projects/academic/YourGroupDir/perl5
Parameters for the './Build' command?
[...]
Your choice: [] --extra_linker_flags -L/projects/academic/YourGroupDir/perl5/lib/perl5
Parameters for the './Build install' command?
[...]
Your choice: [] --uninst 0
[optional]
[...]If your terminal supports UTF-8, you should say no[...]
Your terminal expects ISO-8859-1 (yes/no)? [yes] no
all remaining option are the default...
[...]
You can re-run configuration any time with 'o conf init' in the CPAN shell
vortex1$
Note: this creates a configuration file:
~/.cpan/CPAN/MyConfig.pm
which all users who want to use the projects dir perl modules will want a copy of.
Despite the fact the we have asked for the modules to be installed in /projects the config script still creates a few directories in the home dir...
vortex1$ rmdir -p perl5/bin/ perl5/lib/perl5/*/*
vortex1$
There is a circular dependency when installing Net::SSLeay and IO::Socket::SSL which are required by HTTP::Tiny which is used by cpan to retrieve https:// tarballs
vortex1$ perl -MCPAN -e 'shell'
cpan[1]> install Net::SSLeay
Running install for module 'Net::SSLeay'
Fetching with HTTP::Tiny:
https://cpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.90.tar.gz
HTTP::Tiny failed with an internal error: IO::Socket::SSL 1.42 must be installed for https support
Net::SSLeay 1.49 must be installed for https support
Giving up on '/projects/academic/YourGroupDir/perl5/.cpan/sources/authors/id/C/CH/CHRISN/Net-SSLeay-1.90.tar.gz'
Note: Current database in memory was generated on Wed, 01 Dec 2021 19:41:03 GMT
cpan[2]> exit
vortex1$
Using the paths from above, we need to get the file from
and put it in the directory
/projects/academic/YourGroupDir/perl5/.cpan/sources/authors/id/C/CH/CHRISN
vortex1$ wget -P /projects/academic/YourGroupDir/perl5/.cpan/sources/authors/id/C/CH/CHRISN/ https://cpan.org/authors/id/C/CH/CHRISN/Net-SSLeay
-1.90.tar.gz
[...]
vortex1$ perl -MCPAN -e 'shell'
cpan[1]> install Net::SSLeay
[...]
These tests *will* *fail* if you do not have network connectivity. [n] y
[...]
cpan[2]> install IO::Socket::SSL
Reading '/projects/academic/YourGroupDir/perl5/.cpan/Metadata'
Database was generated on Wed, 01 Dec 2021 19:41:03 GMT
Running install for module 'IO::Socket::SSL'
CPAN: HTTP::Tiny loaded ok (v0.076)
Fetching with HTTP::Tiny:
https://cpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-2.072.tar.gz
HTTP::Tiny failed with an internal error: IO::Socket::SSL 1.42 must be installed for https support
Net::SSLeay 1.49 must be installed for https support
Giving up on '/projects/academic/YourGroupDir/perl5/.cpan/sources/authors/id/S/SU/SULLR/IO-Socket-SSL-2.072.tar.gz'
Note: Current database in memory was generated on Wed, 01 Dec 2021 19:41:03 GMT
cpan[3]> exit
vortex1$
similarly, get the file from:
https://cpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-2.072.tar.gz
and put it in the directory:
/projects/academic/YourGroupDir/perl5/.cpan/sources/authors/id/S/SU/SULLR/
vortex1$ wget -P /projects/academic/YourGroupDir/perl5/.cpan/sources/authors/id/S/SU/SULLR/ https://cpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-2.072.tar.gz
vortex1$ perl -MCPAN -e 'shell'
[...]
cpan[1]> install IO::Socket::SSL
[...]
cpan[2]> exit
vortex1$
Now we can install some required modules & update CPAN
(some of these will only install from the cpan shell)
vortex1$ perl -MCPAN -we 'shell'
cpan[1]> install YAML
[...]
cpan[2]> install Module::Signature
[...]
Import PAUSE and author keys to GnuPG? [y]
[...]
cpan[3]> install Term::ReadKey
[...]
cpan[4]> install Term::ReadLine::Perl
[...]
Enter arithmetic or Perl expression: exit
[...]
cpan[5]> exit
vortex1$ perl -MCPAN -e 'install Test::More'
[...]
vortex1$ perl -MCPAN -e 'install Fatal'
[...]
vortex1$ perl -MCPAN -e 'install CPAN::DistnameInfo'
[...]
vortex1$ perl -MCPAN -e 'install CPAN'
[...]
vortex1$
(finally) the modules you requested can be installed in the perl projects space
vortex1$ perl -MCPAN -e 'shell'
[...]
cpan[1]> install XML::LibXML
[...]
cpan[2]> install XML::SAX
[...]
cpan[3]> install XML::SAX::Exception
XML::SAX::Exception is up to date (1.09).
cpan[4]> install Switch
[...]
cpan[4]> exit
vortex1$
IMPORTANT NOTE:
"module load perl" must be done on every login (and in any SLURM job scripts) or the installed
modules may not work as expected.
27226:164987