Skip to content

Installing Perl libraries

Perl libraries can be installed to your home directory.

First, load a perl module. Use module spider perl to view available perl modules on the cluster you are using. In this example we will use a perl module available on Easley. Easley's perl modules don't need a separate compiler module loaded first.

$> module load perl/5.40.0-kptf

Next, start an interactive cpan shell:

$> perl -MCPAN -e shell

Direct cpan to your home directory:

cpan[1]> o conf makepl_arg INSTALL_BASE=~/perl5

Commit the changes to cpan:

cpan[1]> o conf commit

Exit cpan:

cpan[1]> exit

Now, you need to modify your environment variables. This can be done in the terminal using the following four commands, but would need to be done once per login session before installing perl libraries. Alternatively, you can add these commands to your .bashrc file to have them happen automatically upon logging in.

$> export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"
$> export PERL5LIB="$HOME/perl5/lib/perl5:$PERL5LIB"
$> export PATH="$HOME/perl5/bin:$PATH"
$> eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)

You can now use the cpan commands to install perl modules/libraries:

$> cpan <library>

Some examples are:

$> cpan YAML
$> cpan Math::Utils
$> cpan Thread::Queue

Migrated from UNM-CARC QuickBytes (last source update 2026-07-30). Spotted a problem? Open an issue or pull request.

Machine-readable versions of this page: Markdown twin · raw source on GitHub · llms.txt · llms-full.txt (whole site). See For AI agents.