CPAN::R...:Latest(3)
π CPAN::Releases::Latest π
okay bestie, welcome to CPAN::Releases::Latest β this is a perl manual page from the User Contributed Perl Documentation collection, and it's genuinely iconic. what it does? it finds the latest release(s) of all dists on CPAN, including dev releases π¦
β¨ NAME β¨
CPAN::Releases::Latest β find latest release(s) of all dists on CPAN, including dev releases π
β¨ SYNOPSIS β¨
the vibe, in code:
use CPAN::Releases::Latest;
my $latest = CPAN::Releases::Latest->new(max_age => '1 day');
my $iterator = $latest->release_iterator();
while (my $release = $iterator->next_release) {
printf "%s path=%s time=%d size=%d\n",
$release->distname,
$release->path,
$release->timestamp,
$release->size;
}
β¨ DESCRIPTION β¨
so basically π this module constructs a list of all dists on CPAN, and by default it does that using the MetaCPAN API. the generated index gets cached locally. then it lets you iterate over that index β either release by release, or distribution by distribution. main character energy honestly.
scroll down for the deets on the two iterators you can instantiate, bestie π«Ά
β οΈ note: this is very much an alpha release; all things may change. no cap, it said it, not me π
when you instantiate this class, you can specify the max_age of the generated index. and you can specify that age using any of the expressions supported by Time::Duration::Parse:
5 minutes
1 hour and 30 minutes
2d
3600
if no units are given, it'll be interpreted as a number of seconds. the default for max age is 1 day.
and here's the slay part: if you already have a cached copy of the index, and it's less than the specified age, then we'll use your cached copy and not even check with MetaCPAN. efficient queen π
πΈ distribution_iterator πΈ
the distribution_iterator method returns an iterator which will process the index dist by dist:
my $latest = CPAN::Releases::Latest->new();
my $iterator = $latest->distribution_iterator();
while (my $dist = $iterator->next_distribution) {
print $dist->distname, "\n";
process_release($dist->release);
process_release($dist->developer_release);
}
the iterator returns instances of CPAN::Releases::Latest::Distribution, or undef when the index has been exhausted. and that distribution object has three attributes, periodt:
distnameβ the distribution name as determined byCPAN::DistnameInforeleaseβ a release object for the latest non-developer release, orundefdeveloper_releaseβ a release object for the latest developer release that is more recent than the latest non-developer release, orundef
the release objects are instances of CPAN::Releases::Latest::Release, which get described in the next section, below π
π release_iterator π
the release_iterator method returns an iterator which will process the index release by release. see the example up in the SYNOPSIS π
you'll see the releases ordered distribution by distribution. for a given distribution you'll first see the latest non-developer release, if there is one; if the most recent release for the distribution is a developer release, then you'll see that. so for any dist you'll see at most two releases, and the developer release will always come second π
the release objects are instances of CPAN::Releases::Latest::Release, and they have the following attributes:
distnameβ the distribution name as determined byCPAN::DistnameInfopathβ the partial path for the release tarball (egN/NE/NEILB/enum-1.05.tar.gz)timestampβ an epoch-based timestamp for when the tarball was uploaded to PAUSEsizeβ the size of the release tarball, in bytesdistinfoβ an instance ofCPAN::DistnameInfo, which is constructed lazily π΄
π§ Data source π§
by default the locally cached index is generated using information requested from MetaCPAN, using MetaCPAN::Client. the plugin which does this is CPAN::Releases::Latest::Source::MetaCPAN. you can explicitly specify the source when calling the constructor:
$latest = CPAN::Releases::Latest->new( source => 'MetaCPAN' );
you can use a different source for the data by providing your own plugin β but it has to live in the CPAN::Releases::Latest::Source namespace, bestie, those are the rules π
the plugin must return a hashref that has the following structure:
{
release => {
'Graph' => {
path => 'J/JH/JHI/Graph-0.96.tar.gz',
time => 1369483123,
size => 147629,
},
},
developer => {
'Graph' => {
path => 'N/NE/NEILB/Graph-0.96_01.tar.gz',
time => 1394362358,
size => 147335,
},
}
}
β οΈ at the moment this isn't enforced, but a future version will croak if the source doesn't return the right structure. so like, get it right the first time π
β¨ SEE ALSO β¨
- CPAN::ReleaseHistory β provides a similar iterator, but for all releases ever made to CPAN, even those that are no longer on CPAN. the archive girly ποΈ
- BackPAN::Index β another way to get information about all releases ever made to CPAN. lowkey another route to the same lore π₯
β¨ REPOSITORY β¨
https://github.com/neilb/CPAN-Releases-Latest β go star it bestie β
β¨ AUTHOR β¨
Neil Bowers <neilb@cpan.org> π
β¨ COPYRIGHT AND LICENSE β¨
this software is copyright (c) 2014 by Neil Bowers <neilb@cpan.org>.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. fr fr, go wild π
and that's a wrap, bestie β this page shipped as part of perl v5.42.0, dated 2025-07-25. go iterate over some dists, you absolute icon π
β¨
π¦ where this page comes from
- fedora 43: perl-CPAN-Releases-Latest 0.08-26.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms