Thought I’d share TOKUHIROM’s cpan-outdated tool, which simplifies the task of keeping your installed Perl 5 modules up to date. It simply lists available updates to Perl modules you have installed. That functionality is available in the CPAN shell with the r command, but it is hard to beat the convenience of the cpan-outdated command line tool.
Installing cpan-outdated
cpan-outdated is available on CPAN as “App::cpanoutdated”. Install it with your preferred tool - in my case, cpanminus.
$ cpanm App::cpanoutdatedInstallation will put cpan-outdated on your path.
Using cpan-outdated
Like any good executable, cpan-outdated has a --help option.
$ cpan-outdated --helpUsage: # print the list of distribution that contains outdated modules % cpan-outdated
# print the list of outdated modules in packages % cpan-outdated -p
# verbose % cpan-outdated --verbose
# alternate mirrors % cpan-outdated --mirror file:///home/user/minicpan/
# additional module path(same as cpanminus) % cpan-outdated -l extlib/ % cpan-outdated -L extlib/
# install with cpan % cpan-outdated | xargs cpan -i
# install with cpanm % cpan-outdated | cpanm % cpan-outdated -p | cpanmLet’s see what that looks like on my machine.
$ cpan-outdatedB/BI/BINGOS/Archive-Extract-0.76.tar.gzP/PJ/PJF/autodie-2.29.tar.gzX/XS/XSAWYERX/Dancer2-0.161000.tar.gzB/BO/BOOK/DateTime-Format-Mail-0.402.tar.gzE/ET/ETHER/HTTP-Message-6.07.tar.gzN/NE/NEILB/Lingua-EN-FindNumber-1.31.tar.gzS/SR/SRI/Mojolicious-6.13.tar.gzB/BD/BDFOY/Test-File-1.44.tar.gzE/ET/ETHER/Test-Pod-1.51.tar.gzUse -p to just list packages without path information.
$ cpan-outdated -pArchive::ExtractautodieDancer2DateTime::Format::MailHTTP::HeadersLingua::EN::FindNumberMojoliciousTest::FileTest::PodI find the -p output easier to read at a glance.
Pipe the output of cpan-outdated to cpanminus to immediately update the outdated modules.
$ cpan-outdated -p | cpanm--> Working on Archive::ExtractFetching http://www.cpan.org/authors/id/B/BI/BINGOS/Archive-Extract-0.76.tar.gz ... OKConfiguring Archive-Extract-0.76 ... OKBuilding and testing Archive-Extract-0.76 ... OKSuccessfully installed Archive-Extract-0.76 (upgraded from 0.74)--> Working on autodieFetching http://www.cpan.org/authors/id/P/PJ/PJF/autodie-2.29.tar.gz ... OKConfiguring autodie-2.29 ... OKBuilding and testing autodie-2.29 ... OKSuccessfully installed autodie-2.29 (upgraded from 2.28)--> Working on Dancer2Fetching http://www.cpan.org/authors/id/X/XS/XSAWYERX/Dancer2-0.161000.tar.gz ... OKConfiguring Dancer2-0.161000 ... OKBuilding and testing Dancer2-0.161000 ... OKSuccessfully installed Dancer2-0.161000 (upgraded from 0.160003)--> Working on DateTime::Format::MailFetching http://www.cpan.org/authors/id/B/BO/BOOK/DateTime-Format-Mail-0.402.tar.gz ... OKConfiguring DateTime-Format-Mail-0.402 ... OKBuilding and testing DateTime-Format-Mail-0.402 ... OKSuccessfully installed DateTime-Format-Mail-0.402 (upgraded from 0.401)--> Working on HTTP::HeadersFetching http://www.cpan.org/authors/id/E/ET/ETHER/HTTP-Message-6.07.tar.gz ... OKConfiguring HTTP-Message-6.07 ... OKBuilding and testing HTTP-Message-6.07 ... OKSuccessfully installed HTTP-Message-6.07 (upgraded from 6.05)--> Working on Lingua::EN::FindNumberFetching http://www.cpan.org/authors/id/N/NE/NEILB/Lingua-EN-FindNumber-1.31.tar.gz ... OKConfiguring Lingua-EN-FindNumber-1.31 ... OKBuilding and testing Lingua-EN-FindNumber-1.31 ... OKSuccessfully installed Lingua-EN-FindNumber-1.31 (upgraded from 1.30)--> Working on MojoliciousFetching http://www.cpan.org/authors/id/S/SR/SRI/Mojolicious-6.13.tar.gz ... OKConfiguring Mojolicious-6.13 ... OKBuilding and testing Mojolicious-6.13 ... OKSuccessfully installed Mojolicious-6.13 (upgraded from 6.12)--> Working on Test::FileFetching http://www.cpan.org/authors/id/B/BD/BDFOY/Test-File-1.44.tar.gz ... OKConfiguring Test-File-1.44 ... OKBuilding and testing Test-File-1.44 ... OKSuccessfully installed Test-File-1.44 (upgraded from 1.43)--> Working on Test::PodFetching http://www.cpan.org/authors/id/E/ET/ETHER/Test-Pod-1.51.tar.gz ... OKConfiguring Test-Pod-1.51 ... OKBuilding and testing Test-Pod-1.51 ... OKSuccessfully installed Test-Pod-1.51 (upgraded from 1.50)9 distributions installedThat’s pretty much all there is to it! cpan-outdated is a simple tool, but it fills its role perfectly.