[MetaCPAN] Getting verison numbers for provided modules

Olaf Alders olaf.alders at gmail.com
Tue May 4 22:34:15 GMT 2021


Hi Buddy,

We’ve been trying to get the mailing list removed, so this may be one of the last messages on it.

You could use the API to solve this problem, but I think you can do it more easily with something like https://metacpan.org/pod/OrePAN2 Check out the examples. Basically just inject the tarballs you need into your minicpan and then run the indexer. You’ll then have an 02packages containing all of the modules + versions which you just injected. I think this should solve your problem?

If it doesn’t, I’d suggest taking this to stackoverflow.com You can always send a link to the question to the mailing list. I do have a request in for the list to be removed, but I don’t know when that will actually happen.

All the best,

Olaf

> On May 2, 2021, at 6:56 PM, Buddy Burden <barefootcoder at gmail.com> wrote:
> 
> 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
> 
> _______________________________________________
> MetaCPAN mailing list
> MetaCPAN at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/metacpan




More information about the MetaCPAN mailing list