Norwegian version of this page

Install Perl modules in TSD

How to install Perl modules from the CPAN mirror in TSD

Instructions for Linux users

We have created a copy of CPAN inside TSD (https://cpan.tsd.usit.no) so Perl modules that are not already installed can be installed in the user home areas.

If you've access to software modules, load a Perl module (or else use the system installed Perl):

module load Perl/<version>

Then configure your environment to use the TSD CPAN mirror, home directory installation path and build directory (optional):

# set local installation dir
eval $(perl -Mlocal::lib)

# set directory where CPAN modules are built, not installed
export PERL_CPANM_HOME=/tmp/cpanm_$USER

# configure cpanm to install packages from internal TSD mirror
export PERL_CPANM_OPT='--from https://cpan.tsd.usit.no/'

You can now manage module installations using the following commands:

# Install a module
cpanm Chess

# Check if the Perl module installed correctly:
perl -MChess -e 'print "ok\n"'

# Check all installed Perl modules:
instmodsh
cmd? l

# Check where a Perl module is installed:
cmd? m Chess
d

# Uninstall a Perl module:
cpanm --uninstall Chess

Or in a script:

#!/usr/bin/env perl
use strict;
use local::lib;
use Chess;
 
Search the user manual