複数のperl環境を使う

実際にやったこと

perlbrewのダウンロード

$ curl -LO http://xrl.us/perlbrew
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0    143      0  0:00:01  0:00:01 --:--:--     0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

怒られたのでKオプション(-k)をつけてもう一度。

$ curl -LO http://xrl.us/perlbrew -k

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 45124  100 45124    0     0   9277      0  0:00:04  0:00:04 --:--:-- 58299

権限付与してインストール

$ chmod +x perlbrew
$ ./perlbrew install
The perlbrew is installed as:

    ~/perl5/perlbrew/bin/perlbrew

You may trash the downloaded /home/hogehoge/perlbrew from now on.

Perlbrew environment initiated, required directories are created under

    ~/perl5/perlbrew

Paste the following line(s) to the end of your ~/.bashrc and start a
new shell, perlbrew should be up and fully functional from there:

    source ~/perl5/perlbrew/etc/bashrc

For further instructions, simply run `perlbrew` to see the help message.

Enjoy perlbrew at $HOME!!

先ほどダウンロードしたファイルを移動しておく

$ mv ./perlbrew $HOME/bin/

インストールしたperlbrewを初期化

$HOME/perl5/perlbrew/bin/perlbrew init
Perlbrew environment initiated, required directories are created under

    ~/perl5/perlbrew

Paste the following line(s) to the end of your ~/.bashrc and start a
new shell, perlbrew should be up and fully functional from there:

    source ~/perl5/perlbrew/etc/bashrc

For further instructions, simply run `perlbrew` to see the help message.

Enjoy perlbrew at $HOME!!

"なんかやれっ!"て指示されたので、「~/.bashrc」に追記して、かつ、そのまま打ってみる

$ source ~/perl5/perlbrew/etc/bashrc
$env
 なんだかperlbrew関連のPATHが増えていることが確認できる。

で、最新版のperlをインストールしてみる。

$ perlbrew install perl-5.14.1
Fetching perl-5.14.1 as /home/hogehoge/perl5/perlbrew/dists/perl-5.14.1.tar.gz
Installing /home/hogehoge/perl5/perlbrew/build/perl-5.14.1 into
~/perl5/perlbrew/perls/perl-5.14.1

This could take a while. You can run the following command on another shell to
track the status:

  tail -f ~/perl5/perlbrew/build.log

Installed /home/hogehoge/perl5/perlbrew/build/perl-5.14.1 as perl-5.14.1
successfully. Run the following command to switch to it.

  perlbrew switch perl-5.14.1

最新版perlがインストールされていることを確認した上で、変更。

$ perlbrew list
  perl-5.14.1
* /usr/bin/perl (5.8.8)

$ perlbrew switch perl-5.14.1
$ perlbrew list
* perl-5.14.1
  /usr/bin/perl (5.8.8)
$ perl -v

This is perl 5, version 14, subversion 1 (v5.14.1) 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.