15

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

4

5 回答 5

20

我建议你使用 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 & upgrade 模块

  • cpan-outdated -p | cpanm

变化

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

  • cpanm App::cpanlistchanges
  • 并像这样使用它:cpan-listchanges Plack - 也可以查看 Plack 在您的本地和 CPAN 上的最新版本之间发生了什么变化
于 2012-07-27T07:25:10.313 回答
7
# 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
于 2012-07-27T02:07:53.053 回答
5
$ cpan Module

cpan> install Module 

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

于 2012-07-27T06:14:45.053 回答
4

您应该首先登录到 cpan。然后,在提示符下键入:

r  [enter]

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

cpan upgrade <MODULE NAME>

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

问候,

杰夫

于 2012-07-27T04:10:04.317 回答
1

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

于 2020-04-29T13:16:08.703 回答