So I was going to run a reverse dependency test against tobyink's updated version of Type::Tiny as mentioned here with my Test::BrewBuild software for fun and real-world testing (essentially, it runs the unit tests of all distributions that are up-river from the module in question to ensure changes don't break them, against both Unix (perlbrew) and Windows (berrybrew) installed Perl instances over the network).
I found a flaw in my software. To get the module name for the distribution from a fetched Git repo, I do a find for the *.pm files in the lib/ directory, and pull the first one. When many module files are found, it may pick the wrong one (such as the case with this dist).
Current code:
sub revdeps { my $self = shift; my $log = $log->child('revdeps'); $log->_6('running --revdep'); my @modules; find({ wanted => sub { if (-f && $_ =~ /\.pm$/){ $log->_7("located module: $_"); push @modules, $_; } }, no_chdir => 1, }, 'lib/' ); my $mod = $modules[0]; $log->_7("using '$mod' as the project we're working on"); $mod =~ s|lib/||; $mod =~ s|/|-|g; $mod =~ s|\.pm||; $log->_7("working module translated to $mod"); my @revdeps = $self->_get_revdeps($mod); return @revdeps; }
I'm wondering if there's a nice, clean way to get the primary module. I need to support ExtUtils::MakeMaker, Module::Build and Dist::Zilla. The only safe way I can think of is to glean this from the respective directives in the Makefile.PL, Build.PL or the dist.ini files. Does anyone know of perhaps a cpanm command or other trick that can fetch the distribution name given only the directory of the dist as opposed to having to load/read the build file?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |