Perlbrew – Perl indépenant du système

PerlBrew permet d’installer une version de Perl indépendante de celle du système ce qui permet d(éviter les conflits entre les scripts maison et les paquets système.

Avec Perlbrew il est possible d’installer Perl dans le HOME d’un utilisateur ou dans un répertoire type /opt/perl5 (ce que nous avons choisie ici)

Note : cpan fonctionne normalement avec Perlbrew

Installation

Environnement

Par défaut Perlbrew s’installe dans $HOME/perl5, nous souhaitons l’installer dans /opt/perl5, il faut donc lui préciser un autre lieu :

 $ export PERLBREW_ROOT=/opt/perl5</pre>
$ cd /opt/perl5
$ curl -k -LO http://xrl.us/perlbrew
$ perl ./perlbrew install
$ rm ./perlbrew
$ /opt/perl5/bin/perlbrew init

Les commandes suivante vont modifier le PATH afin

 $ echo "export PERLBREW_ROOT=/opt/perl5" >> ~/.bashrc
$ echo "source /opt/perl5/etc/bashrc" | tee -a ~/.bashrc

Déconnectez-vous ou relancer la bash. Vous devriez avoir de nouvelles variables d’environnement :

 $ env | grep PATH
PATH=/opt/perl5/bin:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin:/opt/scala/cur/bin:/usr/local/mysql/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/opt/scala/cur/bin
PERLBREW_PATH=/opt/perl5/bin

Installation de perl

 $ perlbrew mirror
# Choisir par exemple : 78 : OVH
$ perlbrew -v install perl-5.14.2 -Dusethreads

Switch perl

Actuellement sur le système perl v5.8.8

 $ perl -v

This is perl, v5.8.8 built for x86_64-linux-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
 GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
 this system using "man perl" or "perldoc perl".  If you have access to the
 Internet, point your browser at http://www.perl.org/, the Perl Home Page.

On switch sur l’install de perl 5.14.2

$ perlbrew switch perl-5.14.2
$ perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux

Copyright 1987-2011, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
 GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
 this system using "man perl" or "perldoc perl".  If you have access to the
 Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Retour sur la version système :

 $ perlbrew off
perlbrew is turned off.
$ perl -v

This is perl, v5.8.8 built for x86_64-linux-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
 GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
 this system using "man perl" or "perldoc perl".  If you have access to the
 Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Perl & le CPAN

Installation de CPAN

 $ perlbrew switch perl-5.14.2
$ cpan
# Answer all setup instructions
» o conf commit
» q

Utilisation CPAN

 $ cpanm --interactive -v App::cpanoutdated

Source

  • http://www.perlbrew.pl/
  • http://blog.fox.geek.nz/2010/09/installing-multiple-perls-with.html
  • http://nxadm.wordpress.com/2010/12/10/get-the-latest-perl-release-with-perlbrew/
  • http://www.perl.org/get.html
  • http://search.cpan.org/~gugod/App-perlbrew-0.39/bin/perlbrew#INSTALLATION

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.

En continuant à utiliser le site, vous acceptez l’utilisation des cookies (au chocolat) Plus d’informations

Les cookies sont utilisés à des fin de statistique de visite du blog sur une plateforme indépendante que j'héberge moi même. Les statistiques sot faites avec un logiciel libre. Aucune information n'est redistribué à google ou autre. Je suis seul autorisé à lire ces informations

Fermer