How do I update all my CPAN modules to their latest versions?

PerlCpan

Perl Problem Overview


How do I update all my CPAN modules to their latest versions?

Perl Solutions


Solution 1 - Perl

An alternative method to using upgrade from the default CPAN shell is to use cpanminus and cpan-outdated.

These are so easy and nimble to use that I hardly ever go back to CPAN shell. To upgrade all of your modules in one go, the command is:

cpan-outdated -p | cpanm

I recommend you install cpanminus like the docs describe:

curl -L https://cpanmin.us | perl - App::cpanminus

And then install cpan-outdated along with all other CPAN modules using cpanm:

cpanm App::cpanoutdated

BTW: If you are using perlbrew then you will need to repeat this for every Perl you have installed under it.

You can find out more about cpanminus and cpan-outdated at the Github repos here:

Solution 2 - Perl

An easy way to upgrade all Perl packages (CPAN modules) is the following way:

cpan upgrade /(.*)/

cpan will recognize the regular expression like this and will update/upgrade all packages installed.

Solution 3 - Perl

For Strawberry Perl, try:

cpan -u

Solution 4 - Perl

Try perl -MCPAN -e "upgrade /(.\*)/". It works fine for me.

Solution 5 - Perl

upgrade

BTW there is a help command.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid BView Question on Stackoverflow
Solution 1 - PerldraegtunView Answer on Stackoverflow
Solution 2 - PerlMichael ArmbrusterView Answer on Stackoverflow
Solution 3 - PerlDenis HoweView Answer on Stackoverflow
Solution 4 - PerlMatthias MunzView Answer on Stackoverflow
Solution 5 - PerlmusiKkView Answer on Stackoverflow