12

This may be a duplicate question, so pardon my search skills.

I need to download all dependencies for a specific Perl module (local::lib and others) on a Windows/cygwin machine (with Perl 5.10.1) and move them to a Solaris machine (with Perl 5.8.8) that has no Internet connection.

I have seen minicpan suggested in this question, but creating a complete replica of a CPAN is not an option as I'm on a corporate network with limited bandwidth. CPAN::Mini has some filtering options, but it deals with paths instead of dependencies.

Is there a way to accomplish this?

Thanks,

Ivan

Community
  • 1
  • 1
imiric
  • 8,315
  • 4
  • 35
  • 39

2 Answers2

7

Check out the cpan2dist utility contained in the Perl distribution. (It's in /usr/bin in my Cygwin installation.)

cpan2dist --help

Will create a distribution of type FMT of the modules specified on the command line, and all their prerequisites.

Can also create a distribution of type FMT from a local archive and all it's prerequisites

Haven't tried it, but it sounds like what you're after.

Grzegorz Rożniecki
  • 27,415
  • 11
  • 90
  • 112
Lumi
  • 14,775
  • 8
  • 59
  • 92
  • 1
    I was expecting the typical "perl -MCPAN -e 'install module'" response and was pleasantly surprised! Will have to try this out sometime. – ericslaw May 10 '11 at 16:19
  • 1
    Thanks! I'm accepting this answer, but haven't tried it myself (just used a different machine with Internet access :-P). But from what I've seen in cpan2dist options, you still have to compile all packages and dependencies. I used the following command: `cpan2dist --format CPANPLUS::Dist::Build --buildprereq --skiptest --keepsource local::lib` and it gave me errors compiling prerequisites, so I didn't look further into it. If someone has a cleaner way of just downloading the sources, let me know. – imiric May 11 '11 at 23:25
4

cpanminus has an option to do exactly that: --scandeps and --save-dists. Read more about that option on a blog post explaining the new features of cpanm 1.4.

miyagawa
  • 1,329
  • 7
  • 9
  • 1
    Thanks, this does look good. But I still have the issue that I had before with differing Perl versions. Running `cpanm --scandeps --save-dists -L /tmp/perl5 local::lib` with Perl 5.12.3 yields local::lib only as all other dependencies are in core already. But I'd need a way to specify for which Perl version I want to test against; kind of like an automated tool to download the output of http://deps.cpantesters.org/. Which might not be such a bad idea after all... – imiric May 17 '11 at 23:40
  • this answer https://stackoverflow.com/a/17303468/4940240 has a nice thought: use "-L /dev/null" so that cpanm assumes, that no module ist installed. it will download all non-core modules (as I understand it) – MacMartin Mar 14 '18 at 16:04