💬 Perl scripts and applications do not need installation. They can be simply downloaded and run.
💬 To run Perl applications, it usually best to first load a Perl module.
☝🏻 A system Perl installation is available (without a module), but it is very barebones and is missing many commonly used libraries.
module spider perl
5.34.1
and can be loaded with:module load perl
☝🏻 To ensure scripts use the intended Perl version after loading a module you should either call the script with perl
:
perl my_app.pl
or make sure the shebang line of the script is:
#!/usr/bin/env perl
💬 Sometimes applications may require additional modules to run.
💬 You should check the installation instructions for each module. For
libraries in CPAN, the easiest method is to use cpanm
.
perl -e 'use JSON;'
🗯 By default, cpanm
tries to install new modules to the Perl installation path, which will not work.
/projappl
directory.PERL_BASE
and run the following:export PERL_BASE="/projappl/<project>/$USER/myperl" # example, replace <project> with your CSC project, e.g. project_2001234
export PERL_MM_OPT="INSTALL_BASE=$PERL_BASE"
export PERL_MB_OPT="--install_base $PERL_BASE"
export PERL5LIB="$PERL_BASE/lib/perl5"
cpanm
:cpanm JSON
$PERL5LIB
environment variable (already done above):export PERL5LIB="/projappl/<project>/$USER/myperl/lib/perl5" # replace <project> with your CSC project, e.g. project_2001234
perl -e 'use JSON;'
💬 The installation only needs to be done once, but you need to always ensure Perl knows where to find the installed modules.
💭 There are three main ways to do this (we used the second already):
-I
:perl -I /projappl/<project>/$USER/myperl/lib/perl5 ./my_app.pl # replace <project> with your CSC project, e.g. project_2001234
$PERL5LIB
environment variable:export PERL5LIB=/projappl/<project>/$USER/myperl/lib/perl5:$PERL5LIB # replace <project> with your CSC project, e.g. project_2001234
use lib
use lib '/projappl/<project>/$USER/myperl/lib/perl5';
use My::Module;
💬 If you need the BioPerl collection of Perl modules, you can find this pre-installed on Puhti (try module spider bioperl
).
💡 See our BioPerl documentation for more details.