Howto install Perl modules

This article describes the steps required to install Perl modules in one's home directory.

Run this command and select automatic configuration or accept the defaults as they are presented. This will save the CPAN configuration in your home directory.

perl -MCPAN -e 'mkmyconfig'

Start the interactive CPAN shell.

perl -MCPAN -e shell

Run this command in the interactive shell, note that the specified path begins with a dot so the directory will not show up by defalt in ls output. Also note that the command you run in the interactive CPAN shell starts with the letter o.

o conf makepl_arg PREFIX=~/.perl5
o conf mbuildpl_arg "--install_base ~/.perl5"

While still in the interactive shell, install the module of interest.

install File::Spec::Link

Leave the interactive shell and run this from your regular shell.

export PERL5LIB=$(echo ~/.perl5/lib/perl5)$(if [ ! -z $PERL5LIB ]; then echo -n :; fi)$PERL5LIB

You can verify the procedure worked correctly by running perl and using the module like this.

perl -e 'use File::Spec::Link';

Additional notes. Certain Perl modules have already been installed in a central location on the hoffman2 and can be accessed with the environment module command. This command sets the PERL5LIB environment variable appropriately.

module load perl

This is a simplified set of steps required originally adapted from this link.

https://kb.iu.edu/d/baiu

See also.

http://www.hoffman2.idre.ucla.edu/software/
Creation date: 2/2/2016 4:55 PM     Updated: 2/2/2016 5:22 PM