Search Docs by Keyword

Table of Contents

Perl

Introduction & Setup

In the FASRC Lmod system, you can get most of the Perl modules you need by loading the latest perl_modules module. The list of modules included is here, and you can find the module load commands here.
If you need to install a new one from CPAN there are a couple of ways to do this yourself. First choose a location within your home directory (or another, non-scratch location available to all of the cluster nodes you’ll be using) to use for Perl module installs and one for source downloads.

$ mkdir -p $HOME/apps/src 
$ mkdir -p $HOME/apps/perl/lib/perl5

Once you’ve decided on a location for your Perl module installs, you’ll need to make a number of changes to your .bashrc to direct Perl to look there for modules and use that directory for installs. In your .bashrc include the following lines:

export LOCALPERL=$HOME/apps/perl
export PERL5LIB=$LOCALPERL:$LOCALPERL/lib/perl5:$PERL5LIB
export PERL_MM_OPT="INSTALL_BASE=$LOCALPERL"
export PERL_MB_OPT="--install_base $LOCALPERL"
export PATH="$LOCALPERL/bin:$PATH"

Then download the module you want to use into the downloads directory and unpack it:

$ cd $HOME/apps/src 
$ wget http://search.cpan.org/CPAN/authors/id/T/TW/TWYLIE/modules/FASTAParse-0.0.3.tar.gz 
$ tar xzvf FASTAParse-0.0.3.tar.gz

Since it’s Perl, of course, there’s more than one way to do it. If you’re only doing a handful of simple Perl modules, the basic Makefile.PL or Build.PL installation flavors can be used.

Makefile.PL build

The most common way to perform a local install is to use the Makefile.PL installation.

$ cd FASTAParse-0.0.3 
$ perl Makefile.PL 
$ make 
$ make install

If the install step fails, telling you that you don’t have sufficient permission, check to see that it is trying to install in the directory you specified above. If not, the PERL_MM_OPT variable is unlikely to be set correctly.

Build.PL build

A number of packages prefer the Build.PL form of installation. You’ll need to make sure the perl_modules module is loaded (it depends on the Module::Build module)

$ module load ncf
$ module load perl_modules 
$ cd FASTAParse-0.0.3 
$ perl Build.PL 
$ make 
$ make install

If you’re going to be using a number of Perl modules, or modules you use have a large set of dependencies, you may wish to use the cpan tool.

cpan

The CPAN module and it’s command line tool (cpan) can be used to install modules by name from the CPAN repository. Additionally, it recursively installs any modules that it depends on.
If you’re using the cpan command for the first time, you’ll need to run through a series of configuration prompts.
Running the cpan command will initiate a configuration session
You may be prompted at the end to manually set the download URL list. Use the o conf init urllist command to initiate the configuration.
Setting the download URL preferences from the cpan prompt Setting the download URL preferences from the cpan prompt
You may also want cpan to automatically install dependencies. This can either be set in the interactive configuration, or later at the cpan prompt using the command:

cpan> o conf prerequisites_policy follow

Once cpan is setup, either simple one line command at the terminal prompt can be used to install CPAN modules:

perl -MCPAN -e 'install DBD::SQLite'   OR   cpan DBD::SQLite

Of course, your module will be something other than ‘DBD::SQLite’
Alternatively, cpan can be run interactively.
CPAN module install from the interactive shell CPAN module install from the interactive shell

Troubleshooting

See our FAQ pages (esp. Can’t locate XXX) if you are having troubles with installs.

Packages in perl-modules

Acme-Damn-0.02
Algorithm-Diff-1.1902
BioPerl-1.6.923
Bit-Vector-7.3
Carp-1.32
Class-Data-Inheritable-0.08
Class-Load-0.20
Class-Load-XS-0.06
Clone-0.36
Compress-Raw-Bzip2-2.064
Compress-Raw-Zlib-2.065
Convert-Binary-C-0.76
CPAN-Meta-2.133380
CPAN-Meta-Requirements-2.125
CPAN-Meta-YAML-0.010
Crypt-SSLeay-0.64
Data-Dumper-2.145
Data-OptList-0.109
Data-Stag-0.14
Data-Utilities-0.04
DBD-Pg-3.0.0
DBD-SQLite-1.40
DBI-1.631
Devel-GlobalDestruction-0.12
Devel-StackTrace-1.31
Devel-StackTrace-1.31
Dist-CheckConflicts-0.10
DIYA-1.0
Encode-Locale-1.03
Eval-Closure-0.11
Exception-Class-1.37
Exception-Class-1.37
ExtUtils-CBuilder-0.280212
ExtUtils-MakeMaker-6.98
ExtUtils-ParseXS-3.22
File-Listing-6.04
File-Slurp-9999.19
GD-2.50
Graph-0.96
GraphViz-2.15
HTML-Parser-3.71
HTML-Tagset-3.20
HTTP-Cookies-6.01
HTTP-Daemon-6.01
HTTP-Date-6.02
HTTP-Message-6.06
HTTP-Negotiate-6.01
IO-HTML-1.00
IO-Socket-SSL-1.966
IO-String-1.08
IPC-Run-0.92
JSON-PP-2.27203
libwww-perl-6.05
List-MoreUtils-0.33
local-lib-2.000012
LWP-MediaTypes-6.02
LWP-Protocol-https-6.04
Math-Random-0.71
MIME-Base64-3.14
Module-Build-0.4204
Module-Implementation-0.07
Module-Metadata-1.000019
Module-Runtime-0.013
Moose-2.1202
Mozilla-CA-20130114
MRO-Compat-0.12
Net-HTTP-6.06
Net-SSLeay-1.58
Package-DeprecationManager-0.13
Package-Stash-0.36
Params-Util-1.07
Parse-CPAN-Meta-1.4409
Perl-OSType-1.007
Perl-Unsafe-Signals-0.02
Scalar-List-Utils-1.38
Socket6-0.25
Storable-2.45
String-Approx-3.26
Sub-Exporter-0.987
Sub-Exporter-Progressive-0.001011
Sub-Install-0.927
Sub-Name-0.05
Sub-Uplevel-0.24
Sys-SigAction-0.21
Task-Weaken-1.04
Test-Deep-0.112
Test-Differences-0.61
Test-Exception-0.32
Test-Harness-3.30
Test-Most-0.33
Test-Simple-1.001002
Test-Warn-0.24
Text-Diff-1.41
Time-HiRes-1.9726
Time-Piece-1.27
Tk-804.032
Tree-DAG_Node-1.20
Try-Tiny-0.19
URI-1.60
version-0.9907
Want-0.22
WWW-RobotRules-6.02
XML-Filter-BufferText-1.01
XML-LibXML-2.0110
XML-NamespaceSupport-1.11
XML-Parser-2.41
XML-SAX-0.99
XML-SAX-Base-1.08
XML-SAX-Writer-0.54
XML-Simple-2.20
XML-Twig-3.44
YAML-0.95

© The President and Fellows of Harvard College
Except where otherwise noted, this content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.