はじめに
Perlの学習を始めるにあたり、CentOSに入ってるPerlのバージョンが5.10.1だったので
「初めてのPerl」(リャマ本)第6版で扱ってる5.14系にあげたので手順のメモ。
※2017年11月16日時点の5系最新バージョンは5.26.1
環境
OS
$ cat /etc/redhat-release
CentOS release 6.8 (Final)
Perl
$ perl -v
This is perl, v5.10.1 (*) built for i386-linux-thread-multi
Copyright 1987-2009, 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.
手順
まずはインストールまで。gitから対象バージョンのタグをcheckoutしてmake install。
# git clone git://perl5.git.perl.org/perl.git perl
# git tag -l
# git checkout -b v5.14.4 refs/tags/v5.14.4
# sh Configure -des -Dusethreads -Dinc_version_list=none
# make
# make test
# make install
バージョンチェック
# /usr/local/bin/perl -v
This is perl 5, version 14, subversion 4 (v5.14.4) built for i686-linux-thread-multi
Copyright 1987-2013, 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.
無事インストールされました。
でもこのままだと古いバージョン残ってしまってるので
元のモジュールを退避させつつ、シンボリックリンクを貼って切り替えます。
# cd /usr/bin
# mv perl perl-5.10.1
# ln -s /usr/local/bin/perl .
最終確認
# perl -v
This is perl 5, version 14, subversion 4 (v5.14.4) built for i686-linux-thread-multi
Copyright 1987-2013, 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.
これでバージョンアップ完了。
とりあえずリャマ本進めるにあたってこのバージョンにしたけど
終わったら最新バージョンにあげようかな。