Skip to content

Instantly share code, notes, and snippets.

@stigtsp
Created August 20, 2022 18:32
Show Gist options
  • Save stigtsp/56bdec1b3a1785bcaf66c223e6b5847c to your computer and use it in GitHub Desktop.
Save stigtsp/56bdec1b3a1785bcaf66c223e6b5847c to your computer and use it in GitHub Desktop.
create JSONL for all latest CPAN modules
#! /usr/bin/env nix-shell
#! nix-shell -i perl -p "with perl.pkgs; [ perl MetaCPANClient CpanelJSONXS ]"
use v5.36;
use MetaCPAN::Client;
use Data::Dumper;
use Cpanel::JSON::XS;
my $json = Cpanel::JSON::XS->new->ascii;
$json->canonical(1);
my $mcpan = MetaCPAN::Client->new();
my $releases = $mcpan->release( {
all => [
{ status => 'latest' },
],
} );
while (my $item = $releases->next) {
my $struct = {};
foreach (qw/ id name status author authorized
version version_numified
download_url checksum_sha256
abstract dependency license
provides distribution main_module
stat/ ) {
$struct->{$_} = $item->$_;
}
say $json->encode($struct);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment