加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

升级系统自带的perl

发布时间:2020-12-16 00:36:55 所属栏目:大数据 来源:网络整理
导读:CentOS 系统自带的Perl版本是5.8.8,已经很老了,哥今天折腾一下,把它升级到最新版本。 系统初始状态下的Perl版本 #?perl?-v? ? This?is?perl,?v5.8.8?built?for?x86_64-linux-thread-multi? ? Copyright?1987-2006,?Larry?Wall? ? Perl?may?be?copied?only?

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,?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下安装过的模块需要重新再安装一下,嘿嘿

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读