Collecting my attempts to improve at tech, art, and life

Use cpan-outdated

Tags: perl tools

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::cpanoutdated

Installation will put cpan-outdated on your path.

Using cpan-outdated

Like any good executable, cpan-outdated has a --help option.

$ cpan-outdated --help
        # 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 | cpanm

Let’s see what that looks like on my machine.

$ cpan-outdated

Use -p to just list packages without path information.

$ cpan-outdated -p

I 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::Extract
Fetching ... OK
Configuring Archive-Extract-0.76 ... OK
Building and testing Archive-Extract-0.76 ... OK
Successfully installed Archive-Extract-0.76 (upgraded from 0.74)
--> Working on autodie
Fetching ... OK
Configuring autodie-2.29 ... OK
Building and testing autodie-2.29 ... OK
Successfully installed autodie-2.29 (upgraded from 2.28)
--> Working on Dancer2
Fetching ... OK
Configuring Dancer2-0.161000 ... OK
Building and testing Dancer2-0.161000 ... OK
Successfully installed Dancer2-0.161000 (upgraded from 0.160003)
--> Working on DateTime::Format::Mail
Fetching ... OK
Configuring DateTime-Format-Mail-0.402 ... OK
Building and testing DateTime-Format-Mail-0.402 ... OK
Successfully installed DateTime-Format-Mail-0.402 (upgraded from 0.401)
--> Working on HTTP::Headers
Fetching ... OK
Configuring HTTP-Message-6.07 ... OK
Building and testing HTTP-Message-6.07 ... OK
Successfully installed HTTP-Message-6.07 (upgraded from 6.05)
--> Working on Lingua::EN::FindNumber
Fetching ... OK
Configuring Lingua-EN-FindNumber-1.31 ... OK
Building and testing Lingua-EN-FindNumber-1.31 ... OK
Successfully installed Lingua-EN-FindNumber-1.31 (upgraded from 1.30)
--> Working on Mojolicious
Fetching ... OK
Configuring Mojolicious-6.13 ... OK
Building and testing Mojolicious-6.13 ... OK
Successfully installed Mojolicious-6.13 (upgraded from 6.12)
--> Working on Test::File
Fetching ... OK
Configuring Test-File-1.44 ... OK
Building and testing Test-File-1.44 ... OK
Successfully installed Test-File-1.44 (upgraded from 1.43)
--> Working on Test::Pod
Fetching ... OK
Configuring Test-Pod-1.51 ... OK
Building and testing Test-Pod-1.51 ... OK
Successfully installed Test-Pod-1.51 (upgraded from 1.50)
9 distributions installed

That’s pretty much all there is to it! cpan-outdated is a simple tool, but it fills its role perfectly.

Added to vault 2024-01-15. Updated on 2024-02-01