💬 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.1and 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
or make sure the shebang line of the script is:
💬 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
perl -e 'use JSON;'
🗯 By default,
cpanm tries to install new modules to the Perl installation path, which will not work.
PERL_BASEand 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"
$PERL5LIBenvironment 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):
perl -I /projappl/<project>/$USER/myperl/lib/perl5 ./my_app.pl # replace <project> with your CSC project, e.g. project_2001234
export PERL5LIB=/projappl/<project>/$USER/myperl/lib/perl5:$PERL5LIB # replace <project> with your CSC project, e.g. project_2001234
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.