How to upgrade perl modules that install from CPAN?
Asked Answered
F

5

16

In cpan shell, only /regexp/ or all modules can be upgrade, if I want to upgrade modules only installed by CPAN,how to do?

Fosterfosterage answered 27/7, 2012 at 2:1 Comment(1)
… as opposed to modules that ship with Perl, modules installed from the system's package manager? Please clarify.Misconstrue
C
20

I suggest you using cpanm "family" script for perl modules management.

Install cpanm

  • skip this, if you already have it
  • curl -L http://cpanmin.us | perl - --sudo App::cpanminus
  • if you're on freebsd you can use instead curl the command fetch (see: man fetch)

Upgrade cpanm

  • skip this, if you installed it right now
  • cpanm --self-upgrade --sudo

Install cpan-outdated

  • cpanm App::cpanoutdated
  • The cpan-outdated command do the same as CPAN (r), but IMO better to use from shell

For example, only my notebook gives the result like:

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 cpan-outdated & upgrade modules

  • cpan-outdated -p | cpanm

Changes

If you want see what is changed (Change-log), you can try install cpan-listchanges

  • cpanm App::cpanlistchanges
  • and use it like: cpan-listchanges Plack - too see what's changed in Plack between your local and the latest on CPAN
Coastward answered 27/7, 2012 at 7:25 Comment(2)
>cpanm cpan-outdated not working - ! Couldn't find module or a distribution cpan-outdatedDebose
Correct command is : $ cpan install App::cpanoutdated App::cpanlistchangesDebose
T
8
# 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

Running just the below command will do what you ask.

cpan> upgrade
Tritium answered 27/7, 2012 at 2:7 Comment(1)
bare upgrade command will upgrade all modules that can be upgradeFosterfosterage
B
5
$ cpan Module

and

cpan> install Module 

will upgrade if a newer version is available, and do nothing if you already have the latest version.

Bossy answered 27/7, 2012 at 6:14 Comment(0)
O
4

You should first log into cpan. Then, once at the prompt type:

r  [enter]

That will print out a list of upgradable modules that are installed. After you have that list to work off of you can use the following:

cpan upgrade <MODULE NAME>

Simply replace with the name of the module to upgrade.

Regards,

Jeff

Ogpu answered 27/7, 2012 at 4:10 Comment(0)
K
1

reinstalling the perl package will automatically upgrade using
cpanm --reinstall <Module_Name>

Koblick answered 29/4, 2020 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.