[MetaCPAN] Getting verison numbers for provided modules

Buddy Burden barefootcoder at gmail.com
Sun May 2 22:56:06 GMT 2021


Guys,

Has there really been no activity on this list since 2018?  I guess mailing lists really are out of fashion ... I feel so 
old. :-(  Anyhow, in the hopes that soneone is still listening, here's my question.

Let's say I want to build a 02packages.details.txt file, or a cpanfile.snapshot.[1]  In order to do that, what I need is, 
given a list of releases, find the list of modules that each release provides *and the version number of each module.* 
Getting a list of provided modules for a given release from the MetaCPAN API is pretty easy; I've already done that part. 
But I'm stuck getting the versions for each module.  Issues and ideas that I've tried or thought of thus far:

* Just assume that every module has the same version as its release.  This works surprisingly well for some things, even 
though it's a patently false assumption (some dists like Paws or DBIC don't have any versions at all anywhere than in the 
top-level module, while others such as SQL::Translator have a matching version for some modules and none in others).  But it 
fails abysmally for some others (such as checking to see if you have the right version of a module currently installed).
* Just use the 02packages.details.txt from CPAN itself.  Sadly, that only works for the most recent release of a given dist. 
In my case, I'm trying to reinstall exact (i.e. predictable) versions of dists, so it's rarely the latest release.
* Just steal some code from CPAN.  I can't actually _find_ any code on CPAN that builds 02packages.details.txt, other than 
modules that just accept the info I'm looking for as parameters.[3]  Meanwhile, the Carton code, which I think is the only 
thing that builds a snapshot file, assumes that the modules in question have already been installed and reads the versions 
out of all the MYMETA.json files in the install.  But what I'm trying to do is build this file whether things are installed 
or not.
* Find another MetaCPAN API call that does what I want.  I've looked at all I can think of to look, but I haven't found 
anything so far.

So, is this a possible thing to do?  Can you get the version number from a particular module for a particular release without 
installing that release? or do I need to give up and do it the way Carton does it?


		-- Buddy


[1] It's actually the latter that I'm trying to build, but the requirements are the same either way, and I figured more 
people would be familiar with the former.
[2] https://www.cpan.org/modules/02packages.details.txt
[3] E.g. CPAN::PackageDetails
[4] cf `find_installs` in https://metacpan.org/source/MIYAGAWA/Carton-v1.0.34/lib/Carton/Snapshot.pm



More information about the MetaCPAN mailing list