ARCHIVED: Install and manage Perl modules in your home directory on Carbonate
This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.
On ARCHIVED: Carbonate at Indiana University, use the local::lib
module and CPAN to install and manage your own library of Perl modules:
- Make a personal configuration for use with the CPAN module:
- On the command line, enter:
perl -MCPAN -e 'mkmyconfig'
- When prompted, press
Enter
orReturn
to allow automatic configuration. - For "What approach do you want?", press
Enter
orReturn
to select the default option ( ). - Press
Enter
orReturn
to let the application automatically choose CPAN mirror sites. - Press
Enter
orReturn
to add the necessary environment variables to your shell configuration file. - If prompted to run automatic configuration again, press
Enter
orReturn
to select .You'll see output indicating autoconfiguration is complete, with
MyConfig.pm
written to the following directory (replaceusername
with your IU username):/N/u/username/Carbonate/.cpan/CPAN/MyConfig.pm'
- On the command line, enter:
- When returned to the shell prompt, run the CPAN module; enter:
perl -MCPAN -e shell
- Configure the CPAN module to install new modules in your home directory:
- At the first CPAN prompt (
cpan[1]>
), enter:o conf makepl_arg INSTALL_BASE=~/perl5
You'll see the following output:
makepl_arg [INSTALL_BASE=~/perl5] Please use 'o conf commit' to make the config permanent!
- At the next CPAN prompt, enter:
o conf commit
You'll see the following output (replace
username
with your IU username):commit: wrote '/N/u/username/Carbonate/.cpan/CPAN/MyConfig.pm'
- At the next CPAN prompt, enter:
exit
- At the first CPAN prompt (
- Modify your environment to use the new library of modules:
- If you're using the
bash
shell, add the following lines to your~/.bashrc
file (replaceusername
with your IU username):export PERL_MM_OPT="INSTALL_BASE=/N/u/username/Carbonate/perl5" export PERL5LIB="/N/u/username/Carbonate/perl5/lib/perl5:$PERL5LIB" export PATH="/N/u/username/Carbonate/perl5/bin:$PATH" eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
- If you're using a variant of the C shell, you'll need to set the environment variables manually in your shell configuration file.
- If you're using the
- Use the CPAN module (or the
cpan
command) to install modules locally:$ perl -MCPAN -Mlocal::lib -e 'CPAN::install(Math::Matrix)'
This will produce a lot of output.
- In your Perl script, use the
local::lib
module to have your local library searched when modules are loaded:#!/usr/bin/perl use strict; use local::lib; use Math::Matrix;
If you need help installing and managing Perl modules on Carbonate, contact the UITS Research Applications and Deep Learning team.
This is document baiu in the Knowledge Base.
Last modified on 2023-12-17 07:02:35.