About this series: a collection of short, daily blog posts about lcpan tips/recipes. Some posts will also end up in the upcoming
App::lcpan::Manual::Cookbook POD to be included in the App-lcpan distribution.
About lcpan: an application to download and index a mini CPAN mirror on your local filesystem, so in effect you will have something like your own CPAN with a command-line tool (or perl API) to query and extract information from your mirror. I find it perfect for my own personal use when working offline.
The cpan-outdated script (or its faster variant cpan-outdated-coro) can compare the version of installed CPAN modules against the version that is indexed in
modules/02packages.details.txt.gz file in a CPAN mirror. If your local CPAN mirror is sufficiently up to date (i.e. you have just or quite recently updated it using
lcpan update), you can use your local CPAN mirror for this purpose. This can be a bit faster than using a CPAN mirror on the Internet:
% time cpan-outdated-coro M/ML/MLEHMANN/AnyEvent-7.12.tar.gz K/KA/KAZEBURO/Apache-LogFormat-Compiler-0.33.tar.gz D/DA/DAGOLDEN/Capture-Tiny-0.34.tar.gz L/LE/LEEJO/CGI-4.26.tar.gz E/ET/ETHER/Moose-2.1605.tar.gz D/DR/DROLSKY/DateTime-Format-Strptime-1.64.tar.gz D/DR/DROLSKY/DateTime-TimeZone-1.95.tar.gz I/IS/ISHIGAKI/DBD-SQLite-1.50.tar.gz R/RI/RIBASUSHI/DBIx-Class-0.082821.tar.gz ... real 0m14.681s user 0m7.664s sys 0m0.284s % time cpan-outdated-coro --mirror file:/home/perlancar/cpan ... real 0m8.030s user 0m7.464s sys 0m0.196s
The saving is basically just from not having to download the (currently ~1.7MB)
What can give you more saving is the installation part, because each of the release file is also already available on your local filesystem.
% cpan-outdated-coro --mirror file:/home/perlancar/cpan | cpanm -n --mirror file:/home/perlancar/cpan --mirror-only
Using cpm can be even faster:
% cpan-outdated-coro -p --mirror file:/home/perlancar/cpan | xargs cpm install --mirror file:/home/perlancar/cpan