升级系统自带的perl

简介:

CentOS 系统自带的Perl版本是5.8.8,已经很老了,哥今天折腾一下,把它升级到最新版本。

系统初始状态下的Perl版本

 
  1. # perl -v 
  2.  
  3. This is perl, v5.8.8 built for x86_64-linux-thread-multi 
  4.  
  5. Copyright 1987-2006, Larry Wall 
  6.  
  7. Perl may be copied only under the terms of either the Artistic License or the 
  8. GNU General Public License, which may be found in the Perl 5 source kit. 
  9.  
  10. Complete documentation for Perl, including FAQ lists, should be found on 
  11. this system using "man perl" or "perldoc perl".  If you have access to the 
  12. Internet, point your browser at http://www.perl.org/, the Perl Home Page. 

看一下perl安装在哪

 
  1. # which perl 
  2. /usr/bin/perl 
  3. # ll /usr/bin/perl 
  4. -rwxr-xr-x 2 root root 19200 Jan 21  2009 /usr/bin/perl 

接下来,准备升级操作,下载最新的perl源码包到本地来

 
  1. http://www.cpan.org/src/5.0/perl-5.14.1.tar.gz 

安装

 
  1. # tar perl-5.14.1.tar.gz 
  2. # cd perl-5.14.1 
  3. # ./Configure --help 
  4. Usage: Configure [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value
  5.                  [-U symbol] [-U symbol=] [-A command:symbol...] 
  6.   -d : use defaults for all answers. 
  7.   -e : go on without questioning past the production of config.sh. 
  8.   -f : specify an alternate default configuration file. 
  9.   -h : print this help message and exit (with an error status). 
  10.   -r : reuse C symbols value if possible (skips costly nm extraction). 
  11.   -s : silent mode, only echoes questions and essential information. 
  12.   -D : define symbol to have some value: 
  13.          -D symbol         symbol gets the value 'define' 
  14.          -D symbol=value   symbol gets the value 'value' 
  15.        common used examples (see INSTALL for more info): 
  16.          -Duse64bitint            use 64bit integers 
  17.          -Duse64bitall            use 64bit integers and pointers 
  18.          -Dusethreads             use thread support 
  19.          -Dinc_version_list=none  do not include older perl trees in @INC 
  20.          -DEBUGGING=none          DEBUGGING options 
  21.          -Dcc=gcc                 choose your compiler 
  22.          -Dprefix=/opt/perl5      choose your destination 
  23.   -E : stop at the end of questions, after having produced config.sh. 
  24.   -K : do not use unless you know what you are doing. 
  25.   -O : let -D and -U override definitions from loaded configuration file. 
  26.   -S : perform variable substitutions on all .SH files (can mix with -f) 
  27.   -U : undefine symbol: 
  28.          -U symbol    symbol gets the value 'undef' 
  29.          -U symbolsymbol=   symbol gets completely empty 
  30.        e.g.:  -Uversiononly 
  31.   -A : manipulate symbol after the platform specific hints have been applied: 
  32.          -A append:symbol=value   append value to symbol 
  33.          -A symbol=value          like append:, but with a separating space 
  34.          -A define:symbol=value   define symbol to have value 
  35.          -A clear:symbol          define symbol to be '' 
  36.          -A define:symbol         define symbol to be 'define' 
  37.          -A eval:symbol=value     define symbol to be eval of value 
  38.          -A prepend:symbol=value  prepend value to symbol 
  39.          -A undef:symbol          define symbol to be 'undef' 
  40.          -A undef:symbol=         define symbol to be '' 
  41.        e.g.:  -A prepend:libswanted='cl pthread ' 
  42.               -A ccflags=-DSOME_MACRO 
  43.   -V : print version number and exit (with a zero status). 

找到安装编译参数

 
  1. # ./Configure -des -Dprefix=/usr 
  2. 各参数的含义上面已有 
  3. # make && make install

如没有意外,安装成功,看看现在的版本

 
  1. # perl -v 
  2.  
  3. This is perl 5, version 14, subversion 1 (v5.14.1) built for x86_64-linux 
  4.  
  5. Copyright 1987-2011, Larry Wall 
  6.  
  7. Perl may be copied only under the terms of either the Artistic License or the 
  8. GNU General Public License, which may be found in the Perl 5 source kit. 
  9.  
  10. Complete documentation for Perl, including FAQ lists, should be found on 
  11. this system using "man perl" or "perldoc perl".  If you have access to the 
  12. Internet, point your browser at http://www.perl.org/, the Perl Home Page. 

看看安装的位置

 
  1. # ll /usr/bin/perl 
  2. -rwxr-xr-x 2 root root 1427485 Jul 13 14:06 /usr/bin/perl 

我们这是覆盖安装,替换了原先系统中的原始版本。

新的版本中增加了say函数,让我们写一个简单的脚本来测试一下,看有没有问题

 
  1. #!/usr/bin/perl -w 
  2.  
  3. use strict; 
  4. use 5.14.1; 
  5.  
  6. say "hello,world"; 

output:

 
  1. perl henry.pl  
  2. hello,world 

正确,大功告成,还不赶紧去了解Perl 5.14.1的新特性。哈哈,^__^

注:这样,似乎有一个问题,之前在Perl 5.8.8下安装过的模块需要重新再安装一下,嘿嘿



本文转自dongfang_09859 51CTO博客,原文链接:http://blog.51cto.com/hellosa/610052,如需转载请自行联系原作者

相关文章
|
Linux C语言
Linux中gcc4.8.5升级到gcc5.4.0用已经编译好的安装包升级(重点是不用编译安装,可以更省时)
如有遇到<font color=red size=4>没有网络的情况下</font>可以选择用这种方法来做,前提是要先下载好这个包。
174 0
Linux中gcc4.8.5升级到gcc5.4.0用已经编译好的安装包升级(重点是不用编译安装,可以更省时)
|
网络安全
升级openssh版本
有网络情况下 1 下载包,编译 tar zxvf openssh-7.1p1.tar.gz cd openssh-7.1 ./configure --prefix=/usr --sysconfdir=/etc/ssh make make install 2 解决如下环境报错:    configure: error: *** zlib.
1436 0
|
Linux 网络安全 开发工具
OpenSSH升级版本到最新(8.4)
OpenSSH升级版本到最新(8.4)
1093 0
OpenSSH升级版本到最新(8.4)
|
Perl
如何安装perl模块
由于生物信息早期最多用的语言是perl,因此不可避免就要用别人的perl脚本或者基于perl的项目来处理数据。 使用perl脚本和使用其他编程语言的脚本没啥不同,毕竟你只要传入参数,它就能给你结果。
3160 0
rpm -Uvh 升级时的陷阱
问题现象 用rpm -Uvh升级后,原先的一个软链接被删除了,而采用先rpm -e 卸载rpm包,再rpm -ivh 安装包的方法,这个软链接还在。这个软链接是在rpm包安装的时候建立,也只有在rpm卸载的时候会删除。
1469 0
|
监控 关系型数据库 数据库

热门文章

最新文章