如何升级从CPAN安装的perl模块?

时间:2012-07-27 02:01:22

标签: perl upgrade cpan

在cpan shell中,只有/ regexp /或所有模块都可以升级,如果我想升级仅由CPAN安装的模块,怎么办?

5 个答案:

答案 0 :(得分:17)

我建议你使用cpanm“family”脚本进行perl模块管理。

安装cpanm

  • 跳过这个,如果你已经拥有它
  • curl -L http://cpanmin.us | perl - --sudo App::cpanminus
  • 如果你在使用freebsd,你可以使用命令fetch来取代命令(参见:man fetch)

升级cpanm

  • 如果您现在安装,请跳过此
  • cpanm --self-upgrade --sudo

安装cpan-outdated

  • cpanm App::cpanoutdated
  • cpan-outdated命令与CPAN(r)相同,但IMO最好在shell中使用

例如,只有我的笔记本给出的结果如下:

marvin:~ jomo$ cpan-outdated
S/SM/SMUELLER/Attribute-Handlers-0.93.tar.gz
D/DR/DROLSKY/Class-Load-0.20.tar.gz
D/DR/DROLSKY/DateTime-TimeZone-1.47.tar.gz
... etc

运行cpan-outdated&升级模块

  • cpan-outdated -p | cpanm

更改

如果要查看更改内容(更改日志),可以尝试安装cpan-listchanges

  • cpanm App::cpanlistchanges
  • 并使用它:cpan-listchanges Plack - 也可以看到Plack在本地和最新的CPAN之间发生的变化

答案 1 :(得分:5)

# cpan
cpan> h

Display Information                                                (ver 1.9800)
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
 i        WORD or /REGEXP/  about any of the above
 ls       AUTHOR or GLOB    about files in the author's directory
    (with WORD being a module, bundle or author name or a distribution
    name of the form AUTHOR/DISTRIBUTION)

Download, Test, Make, Install...
 get      download                     clean    make clean
 make     make (implies get)           look     open subshell in dist directory
 test     make test (implies make)     readme   display these README files
 install  make install (implies test)  perldoc  display POD documentation

Upgrade
 r        WORDs or /REGEXP/ or NONE    report updates for some/matching/all modules
 upgrade  WORDs or /REGEXP/ or NONE    upgrade some/matching/all modules

Pragmas
 force  CMD    try hard to do command  fforce CMD    try harder
 notest CMD    skip testing

Other
 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load CPAN.pm again      reload index  load newer indices
 autobundle    Snapshot                recent        latest CPAN uploads

只需运行以下命令就可以满足您的要求。

cpan> upgrade

答案 2 :(得分:3)

您应首先登录cpan。然后,在提示符处输入一次:

r  [enter]

这将打印出已安装的可升级模块列表。在您使用该列表后,您可以使用以下内容:

cpan upgrade <MODULE NAME>

只需更换要升级的模块名称即可。

此致

杰夫

答案 3 :(得分:3)

$ cpan Module

cpan> install Module 
如果有更新的版本,

将升级,如果您已有最新版本,则不执行任何操作。

答案 4 :(得分:1)

重新安装perl软件包将使用
自动升级 cpanm --reinstall <Module_Name>

相关问题