ch0wned – Keeping your own Perl library and cpan in your home directory
Written by max on 2011-04-08
ch0wned. adj. This is the state when you are a Linux user and don't have root access.
Intro
This tutorial is for people wanting to install perl modules using CPAN who do not have root access or wish to keep a network-central module repository that is separated from the local install.
Downloads
Installing
- Unpackage lib::local
tar xvfz local-lib-1.008004.tar.gz
- Choose a library directory
I use a value of $HOME which installs the modules into $HOME/lib/perl5
- Install lib::local into the above spot
cd lib-local-1.008004 perl Makefile.PL --bootstrap=$HOME make make install
Running CPAN
eval `perl -I$HOME/lib/perl5 -Mlocal::lib=$HOME` perl -I$HOME/lib/perl5 -Mlocal::lib=$HOME -MCPAN -e shell cpan[1]> install Awesome::Module::From::CPAN |
Now you can install modules from CPAN as normal as shown above. You might want to put the first two lines into a shell script named “my_cpan” or something.
Specifying your library path in your Perl scripts
use lib '/home/you/lib/perl5';
use Awesome::Module::From::CPAN;
use lib '/home/you/lib/perl5'; use Awesome::Module::From::CPAN; |