92
|
0 |
0 |
unless 'HTTP::Tiny'->new->request('GET', 'http://www.cpan.org/modules/02packages.details.txt', {'data_callback', sub {
my $chunk = shift();
if ($chunk =~ /^Acme::CPANAuthors/ms) {
++$authsec;
$data .= $chunk;
}
elsif ($authsec) {
while ($data =~ m[^(?:Acme::CPANAuthors(?:::(\S+))?).+\w/\w\w/(\w+)/.+$]gm) {
$authors{$2} //= [];
push @{$authors{$2};}, $1;
};
my(%old) = authors();
my(@new) = grep({defined $old{$_} ? () : $_;} keys %authors);
print scalar(@new) . " new Acme::CPANAuthors authors to add\n";
return unless @new;
require MetaCPAN::API;
my $mcpan = 'MetaCPAN::API'->new;
binmode STDOUT, ':utf8';
foreach my $id (sort @new) {
my $author = $mcpan->author($id);
printf " %s => q[%s], # %s\n", $id, $$author{'name'}, join(', ', map({'A::C::' . $_;} @{$authors{$id};}));
};
exit;
};
}
})->{'success'} |