Perl libraries are maintained by community maintainer: Fernando Pineda
Useful tools
pmtools
is a collection of applications for managing perl modules. The documentation can be found here. Two of the most useful modules are:
pmpath | shows full path to a perl module |
pman | show a module’s man page |
For example, to determine whether File::Spec is installed, you would use the command
pmpath File::Spec
Using your own perl modules
Step 1. If you do not already have a directory where you put your perl modules, you must create a directory. Here we assume the directory is named perl5
and we create it in your home directory.
mkdir $HOME/perl5
Step 2. add the following two lines to your bashrc file:
export MYPERL_INSTALL_BASE=$HOME/perl5 module load myperl
The first line creates an environment variable that has the path to where you will install your private modules. (We assume your directory is named perl5
, but if it is not, just use your directory name instead). The second line loads a module that configures your perl environment. In particular it adds all the needed paths to the PERL5LIB environment variable, so that perl can find the perl modules that you have installed.
Step. 3.
It is quite trivial, to install perl modules from the CPAN.org repository. For example, suppose you want to install a package that calculates the phase of the moon: Astro::MoonPhase
. You would install it with the following command:
cpanm --local-lib $MYPERL_INSTALL_BASE Astro::MoonPhase
cpanm
will install the module in the directory you specified in $MYPERL_INSTALL_BASE. You can confirm that it was installed and that perl can find it by using the pmpath
app:
pmpath Astro::MoonPhase
You can also read the documentation with pman
pman Astro::MoonPhase