installing_perl_modules.md 1.52 KB
Newer Older
Adam Caprez's avatar
Adam Caprez committed
1
2
3
+++
title = "Installing Perl modules"
description = "How to install needed Perl modules under your account."
Carrie A Brown's avatar
Carrie A Brown committed
4
weight=90
Adam Caprez's avatar
Adam Caprez committed
5
+++
6
7
8

If you need additional Perl modules, they can be installed into your
home directory.  We recommend using
Adam Caprez's avatar
Adam Caprez committed
9
[Anaconda](https://store.continuum.io/cshop/anaconda) to
10
create an environment with a self-contained, independent Perl install.
Adam Caprez's avatar
Adam Caprez committed
11
This will eliminate any conflicts from the system Perl version and
12
13
allow modules to be installed via `cpan` or `cpanminus`.

Adam Caprez's avatar
Adam Caprez committed
14
### Create an environment with Perl installed
15
16
17
18

The following commands will create an environment called `myperl`, with
Perl and cpanminus installed.

Adam Caprez's avatar
Adam Caprez committed
19
20
{{% panel theme="info" header="Create myperl environment" %}}
{{< highlight bash >}}
21
22
module load anaconda
conda create -n myperl perl perl-app-cpanminus
Adam Caprez's avatar
Adam Caprez committed
23
24
{{< /highlight >}}
{{% /panel %}}
25

Adam Caprez's avatar
Adam Caprez committed
26
### Activate the environment
27
28
29

To use the environment, it must be *activated.*

Adam Caprez's avatar
Adam Caprez committed
30
{{% panel theme="warning" header="Job submission" %}}
31
32
To use your created environment and installed modules in a SLURM job,
the following lines must be included ahead of running any Perl program.
Adam Caprez's avatar
Adam Caprez committed
33
{{% /panel %}}
34

Adam Caprez's avatar
Adam Caprez committed
35
36
{{% panel theme="info" header="Activate environment" %}}
{{< highlight bash >}}
37
38
module load anaconda
source activate myperl
Adam Caprez's avatar
Adam Caprez committed
39
40
{{< /highlight >}}
{{% /panel %}}
41

Adam Caprez's avatar
Adam Caprez committed
42
### Installing a module from CPAN
43
44

Once the environment is activated, modules can be installed via
Adam Caprez's avatar
Adam Caprez committed
45
`cpan` or `cpanm` with no special configuration needed.
46

Adam Caprez's avatar
Adam Caprez committed
47
48
{{% panel theme="info" header="Install a module" %}}
{{< highlight bash >}}
49
cpanm My::Module
Adam Caprez's avatar
Adam Caprez committed
50
51
{{< /highlight >}}
{{% /panel %}}