Created
August 20, 2022 18:32
-
-
Save stigtsp/56bdec1b3a1785bcaf66c223e6b5847c to your computer and use it in GitHub Desktop.
create JSONL for all latest CPAN modules
This file contains 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/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