Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks! I will be offline for a while, and I want to work on my Perl skills that days. But I want to fetch some modules from CPAN, to ensure I won't leave anything back and would need after. Is there a way to extract modules dependencies from an tar.gz module and simply list them? It will make my live much easier! Tks
  • Comment on Getting modules dependecies without installing

Replies are listed 'Best First'.
Re: Getting modules dependecies without installing
by graff (Chancellor) on Aug 02, 2004 at 01:49 UTC
    I'm hoping others more experienced in making module distributions will come in with a more definitive answer, but...

    I just installed "Data::Dump::Streamer" on my laptop earlier today, to try out something posted by another monk. Looking at the unpacked tar file from CPAN just now, I found a file called "META.yml", and in that file, I saw:

    # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX +# name: Data-Dump-Streamer version: 1.10 version_from: lib/Data/Dump/Streamer.pm installdirs: site requires: Algorithm::Diff: 1.15 Data::Dumper: 2.121 Test::More: Text::Balanced: 1.95 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.17
    So, I don't know if every CPAN module tar file includes a "META.yml" file, but if any of them lack this particular feature, then either the module in quesstion has no dependencies, or else there must be some other plain text file in the distro tarball that gives the dependency info.
      So, I don't know if every CPAN module tar file includes a "META.yml" file,

      So do, some don't. The same information is usually in either the Makefile.PL or the Build.PL file. But this will only list the immediate dependencies, and not anything those dependencies depend on.

      I think the best bet is to install them while you have the net connection, and save yourself the possible frustration later on.

      -stvn
Re: Getting modules dependecies without installing
by saintmike (Vicar) on Aug 02, 2004 at 02:23 UTC
    If the module's author has diligently listed the dependencies in Makefile.PL, then you can possibly extract Makefile.PL from the tarball via Archive::Tar and then parse the dependencies via Module::MakefilePL::Parse.

    However, if I'm travelling, I want the entire CPAN to be with me on my laptop's harddisk -- so what I do is just use Randal's minicpan script to create a mirrored CPAN archive and then point CPAN::Config.pm to it:

    urllist => [q[file://home/me/minicpandir]]
    Then the CPAN shell works transparently and will install all modules you ask it for and their dependencies -- even if you're nowhere near an Internet connection.
Re: Getting modules dependecies without installing
by naChoZ (Curate) on Aug 02, 2004 at 02:33 UTC

    You should probably also have a look at Autrijus' module, Module::ScanDeps too.

    --
    "A long habit of not thinking a thing wrong, gives it a superficial appearance of being right." -- Thomas Paine
    naChoZ

Re: Getting modules dependecies without installing
by adrianh (Chancellor) on Aug 02, 2004 at 09:43 UTC
    But I want to fetch some modules from CPAN, to ensure I won't leave anything back and would need after. Is there a way to extract modules dependencies from an tar.gz module and simply list them?

    A simpler solution (assuming you have a reasonable connection and a couple of gig free) might be to copy all of cpan.