In cpan shell, only /regexp/ or all modules can be upgrade, if I want to upgrade modules only installed by CPAN,how to do?
Asked
Active
Viewed 2.9k times
15
-
… as opposed to modules that ship with Perl, modules installed from the system's package manager? Please clarify. – daxim Jul 27 '12 at 10:49
5 Answers
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

clt60
- 62,119
- 17
- 107
- 194
-
2`>cpanm cpan-outdated` not working - `! Couldn't find module or a distribution cpan-outdated` – rustyx Feb 22 '15 at 16:52
-
2Correct command is : `$ cpan install App::cpanoutdated App::cpanlistchanges` – rustyx Feb 22 '15 at 17:08
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
Running just the below command will do what you ask.
cpan> upgrade
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.

ikegami
- 367,544
- 15
- 269
- 518
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

numberwhun
- 956
- 9
- 7
1
reinstalling the perl package will automatically upgrade using
cpanm --reinstall <Module_Name>

lupin
- 173
- 5
- 19