Start using the MetaCPAN API Client to fetch the list of most recently uploaded Perl modules
MetaCPAN is the place where you go if you'd like to find a Perl module and if you'd like to read its documentation.
It also has a public API so we can write a script to search for various things for us.
For example we would like to be able to fetch the most recently uploaded modules.
For this first we need to locate the module that implements the client for the API. It is called MetaCPAN::Client
Then we need to install the module
cpanm MetaCPAN::Client
Then we play around a bit with the documentation and get this script:
examples/meta.pl
use strict; use warnings; use 5.010; use MetaCPAN::Client; my $mcpan = MetaCPAN::Client->new(); my $recent = $mcpan->recent(10); #say $recent; while (my $item = $recent->next) { say $item->name; say $item->distribution; }
We found the recent method of MetaCPAN::Client to return an instance of MetaCPAN::Client::ResultSet holding a list of MetaCPAN::Client::Release objects.
Published on 2020-08-05