安装perl的版本控制器perlbrew

perlbrew可以用源码方式安装perl的各种版本,可以容纳多个perl版本共存,并随意切换。

1、把perlbrew安装到home目录:

curl -L https://install.perlbrew.pl | bash

2、编辑home目录的.bashrc文件,添加perlbrew的可执行文件,

if [ -f ~/perl5/perlbrew/etc/bashrc ]; then
     . ~/perl5/perlbrew/etc/bashrc
fi 

执行一下: source .bashrc 

3、perlbrew的常用语法:

# Initialize
perlbrew init
 
# See what is available
perlbrew available
 
# Install some Perls
perlbrew install 5.18.2
perlbrew install perl-5.8.1
perlbrew install perl-5.19.9
 
# See what were installed
perlbrew list
 
# Swith to an installation and set it as default
perlbrew switch perl-5.18.2
 
# Temporarily use another version only in current shell.
perlbrew use perl-5.8.1
perl -v
 
# Or turn it off completely. Useful when you messed up too deep.
# Or want to go back to the system Perl.
perlbrew off
 
# Use 'switch' command to turn it back on.
perlbrew switch perl-5.12.2
 
# Exec something with all perlbrew-ed perls
perlbrew exec -- perl -E 'say $]'

 

posted @ 2018-03-15 20:41  立体风  阅读(920)  评论(0编辑  收藏  举报