簡體   English   中英

如何升級從 CPAN 安裝的 perl 模塊?

[英]How to upgrade perl modules that install from CPAN?

在cpan shell中,只有/regexp/或所有模塊都可以升級,如果我想升級只有CPAN安裝的模塊,怎么辦?

我建議您使用 cpanm “family” 腳本進行 perl 模塊管理。

安裝cpanm

  • 跳過這個,如果你已經有了它
  • curl -L http://cpanmin.us | perl - --sudo App::cpanminus
  • 如果你在 freebsd 上,你可以使用 curl 命令獲取(參見: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 - 也看看你的本地和 CPAN 上的最新版本之間在 Plack 中發生了什么變化
# 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
$ cpan Module

cpan> install Module 

如果有更新的版本可用,將升級,如果您已經有最新版本,則不執行任何操作。

您應該首先登錄 cpan。 然后,一旦在提示符下鍵入:

r  [enter]

這將打印出已安裝的可升級模塊列表。 在您擁有該列表后,您可以使用以下內容:

cpan upgrade <MODULE NAME>

只需替換為要升級的模塊的名稱。

問候,

傑夫

重新安裝 perl 包將使用自動升級
cpanm --reinstall <Module_Name>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM