User Tools

Site Tools


perl_modules

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

perl_modules [2024/05/06 13:53] – created adminperl_modules [2024/05/06 16:53] (current) admin
Line 1: Line 1:
-**Install Perl Modules In Your Scratch Directory**+=== Install Perl Modules In Your Scratch Directory===
  
 The <wrap hi>local::lib</wrap> module can be used to install extra perl modules that are not available on the cluster by default or in a cluster wide lua module. Follow the instructions below to setup your own modules.  The <wrap hi>local::lib</wrap> module can be used to install extra perl modules that are not available on the cluster by default or in a cluster wide lua module. Follow the instructions below to setup your own modules. 
  
 1. Start with Creating a Perl configuration file, 1. Start with Creating a Perl configuration file,
-  +<code bash> 
 +$ perl -MCPAN -e 'mkmyconfig' 
 +CPAN::MyConfig already exists as /home/matambo/.local/share/.cpan/CPAN/MyConfig.pm. 
 +Running configuration again... 
 + 
 +</code> 
 +Answer yes to the question on automatic configuration, and choose the local::lib option in the question on choice of approach: 
 + 
 +<code bash> 
 +Would you like to configure as much as possible automatically? [yes] 
 +... 
 +What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual'
 + [local::lib] 
 +... 
 +</code> 
 + 
 +Next you will be offered some user environment variables that can be added to your path, answer no. 
 +<code bash> 
 +PATH="/home/username/perl5/bin${PATH:+:${PATH}}"; export PATH; 
 +PERL5LIB="/home/username/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; 
 +PERL_LOCAL_LIB_ROOT="/home/username/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; 
 +PERL_MB_OPT="--install_base \"/home/username/perl5\""; export PERL_MB_OPT; 
 +PERL_MM_OPT="INSTALL_BASE=/home/username/perl5"; export PERL_MM_OPT; 
 + 
 +Would you like me to append that to /home/username/.bashrc now? [yes] no 
 + 
 +</code> 
 +where <wrap hi>username</wrap>  is your login username. After you choose 'no' we will make some changes.  
 + 
 +===Configure CPAN To Install In Your Scratch Directory=== 
 +Run:  
 +<code bash> 
 +perl -MCPAN -e shell 
 +</code> 
 +In the perl shell, run the following: 
 + 
 +<code perl> 
 +cpan[1]> o conf makepl_arg INSTALL_BASE=/home/username/scratch/cpan_modules 
 +</code> 
 + 
 +this will install you perl modules in <wrap hi>/home/username/scratch/cpan_modules</wrap> 
 +At the next CPAN prompt, enter:  
 + 
 +<code perl> 
 +cpan[2]> o conf commit 
 +cpan[3]> exit 
 +</code> 
 + 
 +=== Installing Your Modules=== 
 +To install a module, run the following on the shell 
 +<code bash> 
 +$ perl -MCPAN -Mlocal::lib -e 'CPAN::install(Math::Matrix)' 
 +</code> 
 + 
 +===Using you modules=== 
 +The <wrap hi>local::lib</wrap> module has to be used to search your local library when modules are loaded; 
 + 
 +<code perl> 
 +#!/usr/bin/perl 
 +use strict; 
 +use local::lib; 
 +use Math::Matrix; 
 + 
 +</code> 
 + 
 +===Adding your Perl Modules to  your PATH=== 
 +Add the following to your .bashrc or your shell environment, and the top of your submission script:  
 +<code bash> 
 +PATH="/home/username/scratch/cpan_modules/bin${PATH:+:${PATH}}"; export PATH; 
 +PERL5LIB="/home/username/scratch/cpan_modules/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; 
 +PERL_LOCAL_LIB_ROOT="/home/username/scratch/cpan_modules${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; 
 +PERL_MB_OPT="--install_base \"/home/username/scratch/cpan_modules\""; export PERL_MB_OPT; 
 +PERL_MM_OPT="INSTALL_BASE=/home/username/scratch/cpan_modules"; export PERL_MM_OPT; 
 +</code> 
 +Do this, and re-login before installing any perl module. Remember to replace "username"  with your login username. 
  
  
-Take the time to review the information below: 
-  * [[overview|overview]] 
-  * [[How To Get Access|How To Get Access]] 
-  * [[Getting Started|Getting Started]] 
-  * [[HPC Assistance|HPC Assistance]] 
-  * [[Perl Modules|Install Perl Modules]] 
perl_modules.1714992801.txt.gz · Last modified: 2024/05/06 13:53 by admin