I've made two 'updates' to this post, but I'm going to let it fly for a bit, then I'm going to come back and edit in my updates into the post itself...

Update: In v0.02, we now skip over prereqs where the version is listed as 0 (zero). This signifies that any version of a prereq is acceptable. To disable this and display all prereqs even if the version is zero, use the ignore_any => 0 parameter. /update

Update2: I've updated the distribution (v0.05) to install a binary, checkdep, so that you don't have to write your own to use the library:

Usage: checkdep PAUSEID [options] -a|--all Work on all dependencies, not just the author's -m|--module String; Work only on a specific distribution. (eg: Moc +k::Sub) -z|--zero Include dependencies listed with a version of zero -h|--help Display this help screen

/update2

I've got quite a few CPAN distributions that require one another, and it's gotten to the point that it's very easy to forget to bump prereq versions before uploading a new release to the CPAN.

As a stopgap, I wrote Module::CheckDep::Version (may not be indexed yet). What this module does is using MetaCPAN::Client, fetches all distributions by author, pulls out all prerequisite distributions and the version of it that your distribution has listed, checks if there's a newer version of it, and lists out the ones that need a bump in the prereq's version.

The most basic of runs takes a single parameter, a PAUSE ID (CPAN username), and lists the discrepancies of prereq version mismatches for that author's own prereq distributions *only*. Here's an example of that:

use warnings; use strict; use Module::CheckDep::Version qw(check_deps); check_deps('STEVEB');

Here's the full output of that function call:

RPi-ADC-MCP3008: WiringPi::API: 2.3608 -> 2.3612 RPi::WiringPi::Constant: 0.02 -> 1.00 App-RPi-EnvUI: WiringPi::API: 1.04 -> 2.3612 RPi::DHT11: 1.01 -> 1.02 Logging::Simple: 1.01 -> 1.04 RPi::WiringPi::Constant: 0.02 -> 1.00 Async::Event::Interval: 0.00 -> 0.03 RPi-BMP180: RPi::WiringPi::Constant: 0.02 -> 1.00 WiringPi::API: 2.3608 -> 2.3612 Wrap-Sub: Devel::Examine::Subs: 1.63 -> 1.69 RPi-I2C: WiringPi::API: 2.3609 -> 2.3612 RPi-DigiPot-MCP4XXXX: RPi::WiringPi::Constant: 0.02 -> 1.00 WiringPi::API: 2.3608 -> 2.3612 RPi-WiringPi: RPi::I2C: 2.3602 -> 2.3603 RPi::LCD: 2.3601 -> 2.3603 Devel-Trace-Subs: Mock::Sub: 1.01 -> 1.07 Devel::Examine::Subs: 1.61 -> 1.69 Test-BrewBuild: Plugin::Simple: 0.06 -> 0.07 Logging::Simple: 0.07 -> 1.04 Test::BrewBuild::Plugin::Author: 0.02 -> 0.03 RPi-SPI: WiringPi::API: 2.3608 -> 2.3612 File-Edit-Portable: Mock::Sub: 1.06 -> 1.07 WWW-ProxyChecker: WWW::FreeProxyListsCom: 0.00 -> 1.005 RPi-DAC-MCP4922: WiringPi::API: 2.3608 -> 2.3612 RPi::WiringPi::Constant: 0.02 -> 1.00 RPi-Pin: WiringPi::API: 2.3609 -> 2.3612 Devel-Examine-Subs: Mock::Sub: 1.06 -> 1.07

Using the all => 1 param, we'll check against *all* prereqs, the author's own ones and those of any other author. If it's listed as a dependency, we'll check it:

check_deps('STEVEB', all => 1);

Example (snipped) output:

Devel-Examine-Subs: Test::Trap: 0.00 -> v0.3.2 ExtUtils::MakeMaker: 0.00 -> 7.30 Carp: 0.00 -> 1.38 Data::Dumper: 0.00 -> 2.161 PPI: 0.00 -> 1.236 Mock::Sub: 1.06 -> 1.07 Data::Compare: 0.00 -> 1.25 Geo-Compass-Variation: ExtUtils::MakeMaker: 0.00 -> 7.30 RPi-LCD: ExtUtils::MakeMaker: 6.72 -> 7.30

You can look up only a single distribution instead of listing all of them (this works with all => 1 as well):

check_deps('STEVEB', module => 'RPi::WiringPi');

Output:

Pi-WiringPi: RPi::I2C: 2.3602 -> 2.3603 RPi::LCD: 2.3601 -> 2.3603

You can request the data back (a hashref of hashrefs) instead of displaying it to STDOUT:

my $data = check_deps('STEVEB', return => 1);

...and finally, you can send in a code reference to handle the data within the module instead of getting it returned or printed. This sub can do anything you want it to. You get passed a single parameter, a hashref of hashrefs, same as with the return functionality:

check_deps('STEVEB', handler => \&my_handler); sub my_handler { my $data = shift; for my $dist (keys %$data){ for my $dep (keys %{ $data->{$dist} }){ my $dep_ver = $data->{$dist}{$dep}{dep_ver}; my $cur_ver = $data->{$dist}{$dep}{cur_ver}; print "$dist has dep $dep with listed ver $dep_ver " . "and updated ver $cur_ver\n"; } } }

Sample output:

App-RPi-EnvUI has dep Async::Event::Interval with listed ver 0.00 and +updated ver 0.03 Devel-Trace-Subs has dep Devel::Examine::Subs with listed ver 1.61 and + updated ver 1.69 Devel-Trace-Subs has dep Mock::Sub with listed ver 1.01 and updated ve +r 1.07 RPi-WiringPi has dep RPi::LCD with listed ver 2.3601 and updated ver 2 +.3603 RPi-WiringPi has dep RPi::I2C with listed ver 2.3602 and updated ver 2 +.3603

I was going to hook this into an automation script using other tools I have written, but I just don't have the time. Just knowing what needs to be updated is fine for me for now.

Next version will have the ability to optionally skip prereqs that the author has set to 0 (ie. any version is acceptable).

As always, have fun!


In reply to Checking if your CPAN distributions need to bump their prereq versions by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.