【问题标题】:How to upgrade perl modules that install from CPAN?如何升级从 CPAN 安装的 perl 模块?
【发布时间】:2012-07-25 16:49:18
【问题描述】:

在cpan shell中,只能升级/regexp/或all模块,如果我想升级只有CPAN安装的模块,怎么办?

【问题讨论】:

  • ... 与 Perl 附带的模块相反,模块是从系统的包管理器安装的?请澄清。

标签: perl upgrade cpan


【解决方案1】:

我建议你使用 cpanm "family" 脚本来管理 perl 模块。

安装cpanm

  • 如果您已经拥有它,请跳过它
  • curl -L http://cpanmin.us | perl - --sudo App::cpanminus
  • 如果您使用的是 freebsd,则可以使用 curl 命令 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

变化

如果你想看看有什么变化(Change-log),你可以尝试安装cpan-listchanges

  • cpanm App::cpanlistchanges
  • 并像这样使用它:cpan-listchanges Plack - 还可以查看 Plack 中本地和 CPAN 上最新版本之间的变化

【讨论】:

  • >cpanm cpan-outdated 不工作 - ! Couldn't find module or a distribution cpan-outdated
  • 正确的命令是:$ cpan install App::cpanoutdated App::cpanlistchanges
【解决方案2】:
# 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

【讨论】:

  • 裸升级命令将升级所有可以升级的模块
【解决方案3】:
$ cpan Module

cpan> install Module 

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

【讨论】:

    【解决方案4】:

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

    r  [enter]
    

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

    cpan upgrade <MODULE NAME>
    

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

    问候,

    杰夫

    【讨论】:

      【解决方案5】:

      重新安装 perl 包会自动升级使用
      cpanm --reinstall &lt;Module_Name&gt;

      【讨论】:

        猜你喜欢
        • 2010-12-05
        • 2013-06-27
        • 1970-01-01
        • 2016-07-08
        • 2014-02-18
        • 2013-06-30
        • 1970-01-01
        • 2011-10-10
        • 2013-11-22
        相关资源
        最近更新 更多