sorin
sorin

Reputation: 170798

How to upgrade all perl CPAN modules installed in a user directory?

I have a user directory with CPAN modules and I want to have a script that will upgrade all of the to their latest release.

Note: it should be executable by any user not only root.

What is the proper command to do this?

I know that cpan -r should upgrade CPAN modules but I want to force it to do this only for those installed in this specific directory.

Upvotes: 2

Views: 750

Answers (2)

FUJI Goro
FUJI Goro

Reputation: 889

cpan-outdated can help you.

https://metacpan.org/module/cpan-outdated

upgrade all versions installed:

cpan-outdated | cpanm

upgrade modules installed in a specified dir

cpan-outdated -lextlib | cpanm -lextlib

Upvotes: 1

ikegami
ikegami

Reputation: 386646

cd ~/perl5/lib &&
find -name '*.pm' \
| perl -ple's{^\./}{}; s{/}{::}g; s{\.pm\z}{};' \
| xargs cpan

Upvotes: 0

Related Questions