Thursday, July 29, 2010

App::cpanoutofdate for keeping local::lib cpan up-to-date

A new version of App::cpanoutdated was released yesterday which ads a new -l and -L option to the bundled binary,cpan-outdated. These flags work the same as -l and -L in cpanminus, pointing to a local::lib controlled directory.

--compare-changes shows the difff to the changes file between releases. That's awesome.

This code will update all of the out of date modules in /apps/perl5 which is a local::lib controlled directory on my system: cpan-outdated -l /apps/perl5 | xargs cpanm -l /apps/perl5

--compare-changes example

cpan-outdated --compare-changes| head -20
S/SA/SARTAK/Any-Moose-0.13.tar.gz
0a1,23
> 0.13  Wed 19 May 2010
>   * Add load_first_existing_class (gfx)
> 
> 0.12  Fri 02 Apr 2010
>   * t/000-version.t for better diagnostics (tokuhirom)
>   * Slight performance improvements for is_class_loaded,
>       lazily loading Carp, etc (Sartak)
>   * Start some real documentation (Sartak)
>   * Document $ENV{ANY_MOOSE} (Sartak)
>     - fixes [rt.cpan.org #52339]
>   * Test that Moose is loaded, not CMOP (Sartak)
>     - fixes [rt.cpan.org #56093]
>   * Alias class_of and more functions (Sartak)
>     - requested by [rt.cpan.org #52275]

Usage:

cpan-outdated --help                
Usage:
        # print list of outdated modules
        % cpan-outdated

        # verbose
        % cpan-outdated --verbose

        # output changes diff
        % cpan-outdated --compare-changes

        # alternate mirrors
        % cpan-outdated --mirror file:///home/user/minicpan/

        # additional module path
        % cpan-outdated -I extlib/

        # install with cpan
        % cpan-outdated | xargs cpan -i

        # install with cpanm
        % cpan-outdated | xargs cpanm

2 comments:

Tommy Stanton said...

Good post, but the name of the module is actually "App::cpanoutdated". [0]

[0] http://search.cpan.org/dist/App-cpanoutdated/ [1]
[1] Was a footnote really necessary?

Andrew Grangaard said...

Thanks[0]. Updated.

[0] of course it was necessary.