User Library Configuration

Using local::lib and a modified CPAN configuration

1. Configure CPAN (do this first because an endless loop can be caused by the following PERL_MM_USE_DEFAULT step).

$ cpan
# This allows you to select options (for example the mirror)

2. Configure CPAN to automatically answer with default (usually "yes")
This is an ExtUtils::MakeMaker environment variable.

$ export PERL_MM_USE_DEFAULT=1
# (add this to your .bashrc/.bash_profile)

3. Install local::lib

$ perl Makefile.PL --bootstrap
# (add "eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)" to your .bashrc/.bash_profile)
# Run the above or start a new shell to make local::lib active

4. Install CPAN::Bundle for a nicer CPAN experience.

$ cpan CPAN::Bundle

5. Install perl5i

$ cpan perl5i

Using perlbrew and cpanm

Perlbrew is an ultra-easy way to install multiple user-level perl versions and switch between them freely. App::cpanminus / cpanm is a light-weight and also ultra-easy way to install modules from CPAN and works very easily with Perlbrew.

1. Install Perlbrew

$ curl -kL http://install.perlbrew.pl | bash
$ source ~/perl5/perlbrew/etc/bashrc

I set up a bash alias to active perlbrew only when I want it - meaning that until I do so everything I do is with the system perl:

alias pbon='source ~/perl5/perlbrew/etc/bashrc'

2. Install perlbrew perl

$ perlbrew available
  perl-5.17.7
  perl-5.16.2
  perl-5.14.3
  perl-5.12.5
  perl-5.10.1
  perl-5.8.9
  perl-5.6.2
  perl5.005_04
  perl5.004_05
  perl5.003_07
$ perlbrew install perl-5.16.2
$ perlbrew switch perl-5.16.2

3. Install cpanm

$ perlbrew install-cpanm

4. Install perl modules

cpanm Acme::Everything

(Possibly not such a good idea)

BradsWiki: Programming Notes/PerlProgramming/UserLibraryConfiguration (last edited 2013-01-10 00:33:53 by BradleyDean)