in reply to Finding what modules use and what uses the modules

update: d'oh! Another reminder not to post before first coffee of the day; my example below will not work in OPs case, as the modules are not yet on the CPAN :) Works well for those that are though.../update

Here's a modified version of a script I wrote that allows me to see if I have any of my distributions on the CPAN where I need to do required module version bumps in my Makefile.PLs for the required modules where I'm the author (original is here). It uses MetaCPAN::Client to do the hard work. Given a module name, it prints out its dependencies, as well as the reverse dependencies (which other modules use it. In CPAN speak, that's "upriver").

In this case, the module is hardcoded for the example, but pretty trivial to make it an argument.

use warnings; use strict; use MetaCPAN::Client; my $c = MetaCPAN::Client->new; my $dist = 'Mock::Sub'; check_deps($dist); rev_deps($dist); sub check_deps { my $dist = shift; $dist =~ s/::/-/g; my $release = $c->release($dist); my $deps = $release->{data}{dependency}; print "Dependencies:\n\n"; print "$_->{module}\n" for @$deps; } sub rev_deps { my $dist = shift; $dist =~ s/-/::/g; my @revdeps; my $rs = $c->rev_deps($dist); while (my $release = $rs->next){ push @revdeps, $release->distribution; } print "\nReverse Dependencies:\n\n"; for (@revdeps){ s/-/::/g; print "$_\n"; } }


Dependencies: perl Carp Scalar::Util Test::More ExtUtils::MakeMaker Reverse Dependencies: Devel::Examine::Subs File::Edit::Portable RPi::DigiPot::MCP4XXXX Test::BrewBuild App::RPi::EnvUI Devel::Trace::Subs PSGI::Hector