October 2010 Archives

local::lib and perlbrew

Because I seem to be doing this a lot at the moment, here’s my quick-start to local::lib and perlbrew … the saner way to run perl!

# create a working area
mkdir $HOME/setup
cd $HOME/setup

# install local::lib
wget http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.008004.tar.gz
tar zxf local-lib-1.008004.tar.gz
cd local-lib-1.008004/
perl Makefile.PL --bootstrap
make test
make install

# enable local::lib for future logins
echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc

# enable local::lib now
eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)

# install perlbrew
curl -L http://cpanmin.us | perl - App::cpanminus
cpanm App::perlbrew

# enable perlbrew for future logins
echo \
'if [ -f $HOME/perl5/perlbrew/etc/bashrc ]; then
  source $HOME/perl5/perlbrew/etc/bashrc;
fi' \
>> ~/.bashrc

# brew ourselves a perl to use
perlbrew init
source $HOME/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.12.3

If all went well you’ll find yourself with a localised perl installation. Some days I really wish I’d discovered this before I $^!%ed all over my system perl installation.

(I actually manage the .bashrc entries in a different way, but that’s an entry for another day, and this is a good approach to the problem).

About Chisel