[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

This is an old revision of the document!


Table of Contents

Perlbrew at ÚFAL

Perlbrew is a great tool for switching different versions of perl.
I've created a new shared ÚFAL repository of Perl modules using Perlbrew as a substitute of the old PERLREPO.

Martin Popel

How to setup the Perlbrew environment

Add to your ~.bashrc:

source /net/work/projects/perlbrew/init
eval "$(bash-complete setup)"

The second line is optional, but it enables Bash Completion for perlbrew, cpanm and treex.

How to use Perlbrew

perlbrew list               # Which perl versions are installed?
perlbrew use perl-5.16.3    # use one of these perls for the current shell
perlbrew switch perl-5.16.3 # use this perl version permanently
perlbrew off                # return to the system installation of perl

How to install missing modules from CPAN

If you see an error message such as Can't locate String/Diff.pm in @INC, it means the module String::Diff is not installed.
You can install it into the ÚFAL perlbrew repository, so it will be available also for others.
If you are used to cpan tool, you can use it, but I recommend using cpanm, which is faster.

cpanm String::Diff

This installs String::Diff for the current architecture (32bit vs. 64bit) and the currently selected Perl version.
If you want to install it for all Perl versions and the current architecture, use this trick

perlbrew exec cpanm String::Diff

If you did this on your machine (32bit), you still need to ssh to some 64bit machine (e.g. sol1) and install it there, if you want the module to be available from the LRC cluster.

Useful switch for cpanm is -n (notest, useful e.g. for cpanm -n Tk). See cpanm -h for more (e.g. installing from github, installing to your own local-lib).
You can install the modules also manually (perl Build.PL && ./Build && ./Build test && ./Build install). There is no need to set –prefix nor –install_base, because you (everyone group ufal) have write access to the shared ÚFAL perlbrew repository.

How to install new Perl version

perlbrew available                    # list perl versions available for download
perlbrew install perl-5.16.3          # install this older version
perlbrew install -Dcc=gcc perl-5.16.3 # on Ubuntu10.04 64bit, I had to use this switch

Now, we probably want to install all modules from the current perl to the new perl:

perlbrew list-modules > list.txt
perlbrew switch perl-5.16.3
cpanm < list.txt

[ Back to the navigation ] [ Back to the content ]