r0.ini has asked for the wisdom of the Perl Monks concerning the following question:

The CPAN file 02packages.details.txt.gz only has the mapping of distribution <-> module only for the latest version of a module. In fact, the "r" command in the cpan shell tells you which distribution file you have to download to obtain the latest version, but cpan nevers tells you from which distribution file you obtained the current version of the module. I think that data is not saved anywhere.
Anybody knows how to (programatically) obtain the distribution file from which a given module (a specific version) was installed?
  • Comment on How to obtain the distribution file for the specific version of a module

Replies are listed 'Best First'.
Re: How to obtain the distribution file for the specific version of a module
by brian_d_foy (Abbot) on Dec 23, 2007 at 17:36 UTC

    Jon Rockway and I are working on a way to find old distributions easily, but it probably won't be done during the holidays. We're indexing all 9 Gb of BackPAN so you can search by module name and version to get to the right package. Some of those might still be on CPAN, but they might have been removed to clean up an author's directory.

    For now you have to find the old distros on BackPAN. The easiest way to find them is to start in the current author's directory and look in the distros yourself. Bisect the list of distros until you find the one that you want. Watch out for distros that have the same module versions. The distro version isn't necessarily tied to any module version, and when it is, it's the version of a particular module, not all of the other ones that came with it.

    The next trick after finding the right distro is to figure out if it works with the latest versions of its dependencies. We're working on that too so we can tell you which versions of its dependencies were current when that distro was released.

    If you're using the latest version of my cpan script, you can use the -D switch to see the details of the latest version:

    $ cpan -D Tie::Cylce Tie::Cycle ---------------------------------------------------------- Cycle through a list of values via a scalar. B/BD/BDFOY/Tie-Cycle-1.16.tar.gz /usr/local/lib/perl5/site_perl/5.8.8/Tie/Cycle.pm Installed: 1.15 CPAN: 1.16 Not up to date brian d foy (BDFOY) bdfoy@cpan.org
    --
    brian d foy <brian@stonehenge.com>
    Subscribe to The Perl Review
      Brian, were you able to advance in that project with Jon Rockway?
Re: How to obtain the distribution file for the specific version of a module
by ysth (Canon) on Dec 23, 2007 at 06:08 UTC
    No. For what's on CPAN, you could scrape the http://search.cpan.org/dist/Distname-Version pages looking for the version you want, but presumably the distribution you want may be on backpan instead (or the distribution may have changed names along the way).

    I highly recommend keeping the distribution tarballs you might want later in some very safe place, and bypassing this problem entirely.