Skip to content

Instantly share code, notes, and snippets.

@neilb
Created April 7, 2014 21:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neilb/10059886 to your computer and use it in GitHub Desktop.
Save neilb/10059886 to your computer and use it in GitHub Desktop.
Create a list of CPAN distributions where the dist name in the metadata doesn't match the distname as embedded in the release file name
#!/usr/local/bin/perl
#
# This find dists where the distname in the metadata doesn't match the name of the
# dist as embedded in the release file name.
#
use strict;
use warnings;
use MetaCPAN::Client;
use CPAN::DistnameInfo;
my $client = MetaCPAN::Client->new();
my $query = {
all => [
{ status => 'latest' },
{ maturity => 'released' },
],
};
my $params = {
fields => [
qw(metadata download_url version)
],
};
my $result_set = $client->release($query, $params);
my $scroller = $result_set->scroller;
while (my $result = $scroller->next ) {
my $release = $result->{fields};
my $distname = $release->{metadata}->{name};
my $path = $release->{download_url};
$path =~ s!^.*/authors/id/!!;
my $distinfo = CPAN::DistnameInfo->new($path);
next unless defined($distinfo) && defined($distinfo->dist);
if ($distinfo->dist ne $distname) {
printf "%s\n Metadata: %s\n CDI dist: %s\n\n", $path, $distname, $distinfo->dist;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment