Looking up reverse dependencies

CPANMetaCPANdependencies Sun 23 February 2014

I've released the first version of CPAN::ReverseDependencies, which given the name of one CPAN distribution, will return a list of the names of other CPAN distributions that use it. This uses the MetaCPAN API, and is based on some code that I think I got from OALDERS.

To find out what distributions are using the enum distribution, you'd write:

use CPAN::ReverseDependencies;
my $getter = CPAN::ReverseDependencies->new();

my @deps = $getter->get_reverse_dependencies('enum');
print "enum is used by @deps\n";

Note that this is all based on declared dependencies: it finds distributions that say they're using the specified distribution.

I'm still not sure of the naming. I was thinking of calling the module CPAN::Distribution::ReverseDependencies, to make it clear that it's working with distributions and not modules. Plus that function name get_reverse_dependencies() is a tad long.

Perhaps CPAN::Distribution::Dependencies, and I could support looking up of both forward and reverse dependencies...

comments powered by Disqus