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

zha*_*lin 15 perl cpan upgrade

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

jm6*_*666 19

我建议你使用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
Run Code Online (Sandbox Code Playgroud)

运行cpan-outdated和升级模块

  • cpan-outdated -p | cpanm

变化

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

  • cpanm App::cpanlistchanges
  • 并使用它:cpan-listchanges Plack - 也看看普拉克在本地和最新的CPAN之间发生了什么变化

  • `> cpanm cpan-outdated`不工作 - `!找不到模块或分发cpan-outdated` (2认同)
  • 正确的命令是:`$ cpan install App :: cpanoutdated App :: cpanlistchanges` (2认同)

cdt*_*its 6

# 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
Run Code Online (Sandbox Code Playgroud)

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

cpan> upgrade
Run Code Online (Sandbox Code Playgroud)


ike*_*ami 5

$ cpan Module
Run Code Online (Sandbox Code Playgroud)

cpan> install Module 
Run Code Online (Sandbox Code Playgroud)

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