-
-
Save mishin/f1debd38154bda72dec0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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