Perl – How to upgrade perl modules that install from CPAN

cpanperlupgrade

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

Best Answer

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