もう少しPerlの勉強をと思い、以前perlbrewをインストールしていましたが、plenvというものもあるということで、そちらをインストールしてみました。
@ytnobody さんが作成した、plenv
簡単導入プログラムというものがあるのですが、残念ながらレオサーバーでは、上手く動かないので、もう少し地道にインストールです。
plnevのGihub(https://github.com/tokuhirom/plenv)のインストールを参考にインストールします。
gitが必要なので、gitがなければ、インストールします。
①gitのダウンロード
1 |
$ git clone https://github.com/tokuhirom/plenv.git ~/.plenv |
②.bashrcの修正
.bash_profileにPATH等を追加するようになっていますが、今回の環境では権限の関係で、.bashrcに次を追加します。(git等の環境のために$HOME/local/binが入っています)
1 2 |
export PATH=$HOME/.plenv/bin:$HOME/local/bin:$PATH eval "$(plenv init -)" |
③シェルを再起動します
1 |
$ exec $SHELL -l |
④perl-buildをインストールします。
1 |
$ git clone https://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/ |
これでplnevのインストールは完了です。
念のため以下のコマンドでバージョンを確認してみます。
1 2 |
$ plenv --version plenv 2.1.1-56-g626847c |
ただし、これだけでは、perlは使えないので、perlをインストールします。
・インストールできるPerlのバージョンの確認
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$ plenv install --list Available versions: 5.6.0 ~ ~ 5.22.0 5.22.1-RC1 5.22.1-RC2 5.22.1-RC3 5.22.1-RC4 5.22.1 5.23.0 5.23.1 5.23.2 5.23.3 5.23.4 5.23.5 5.23.6 |
・バージョンを指定してインストール
(結構時間がかかります。気長に待ってください。)
1 |
$ plenv install 5.22.1 |
これで新しいperlが!ではないです。perlのバージョンを確認すると
1 2 3 |
$ perl -v This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi |
これは、デフォルトがsysytemになっているため。
変更は次のように行います。
1 |
$ plenv global 5.22.1 |
そうすると、
1 2 3 4 |
$ perl -v This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux (with 1 registered patch, see perl -V for more detail) |
こんな感じになります。
cpanのモジュールをインストールするには、cpanmをインストールします。
1 |
$ plenv install-cpanm |
その後はcpanmが普通に使えます。
その他はヘルプを
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$ plenv help Usage: plenv <command> [<args>] Some useful plenv commands are: commands List all available plenv commands local Set or show the local application-specific Perl version global Set or show the global Perl version shell Set or show the shell-specific Perl version install Install a Perl version using the perl-build plugin uninstall Uninstall a specific Perl version rehash Rehash plenv shims (run this after installing executables) version Show the current Perl version and its origin versions List all Perl versions available to plenv which Display the full path to an executable whence List all Perl versions that contain the given executable list-modules List cpan modules in current perl migrate-modules Migrate cpan modules from other version install-cpanm Install cpanm See `plenv help <command>' for information on a specific command. For full documentation, see: https://github.com/tokuhirom/plenv#readme |
コメント