Folks,

I have to install about 10 modules from CPAN on a machine to get an application going. Since the machine does not have an internet connection, I transfered the archived modules to it and installed them manually, with lots of 'perl Makefile.PL' and all that.

Is there already a way to automate this process ? I could write a bash script (or even better, a small Perl program ;-) to do the installations but surely there's already at least one solution out there,

Amongst the undoubtly many solutions, which one would you recommened ? This is for Linux-only systems. One nice criteria would be that the solution does not require itself 10 modules to run...

Thanks !

Update:

On CPAN I found megadistro, a recent package that, after a fe wtries, seems to successfully get from the CPAN specified modules, build them, and produce either a RPM, a Debian, or simply a tar.gz package.

I've chosen the tar.gz option for testing since this is part of the requirements.

My CPAN(PLUS) module(s) are set to operate as root. So far, I did not look into making it work as an ordinary user. So, to use megadistro I logged in as root. Warning: megadistro will not create the /root/.megadistro directory to put the archive file of all the modules. You have to create it beforehand.

1) I've created a text file with a few module names:

Acme::Bleach Acme::EyeDrops Acme::BadExample

2) I've created some test directories for megadistro to operate:

~/MegaDistro/mega_build/ ~/MegaDistro/mega_dl/ ~/MegaDistro/mega_extract/

3) I've launched megadistro like this, to produce a tar.gz file:

megadistro --build-only \ --modlist=~/MegaDistro/megadistro.list \ --fetchdir=~/MegaDistro/mega_dl \ --extractdir=~/MegaDistro/mega_extract \ --builddir=~/MegaDistro/mega_build

Megadistro then spent some time at the following line (on a X86_64 dual core fast machine it stayed there foreover, so I killed it, but on a plain x86 it works fine):

Rebuilding module indicies...

It then produced the following file in /root/.megadistro:

megadistro-20060303.tar.gz

And this archive file contains stuff like:

usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/auto/Acme/Blea +ch usr/lib/perl5/vendor_perl/5.8.6/Acme/Bleach.pm usr/lib/perl5/vendor_perl/5.8.6/Acme/EyeDrops.pm usr/lib/perl5/vendor_perl/5.8.6/Acme/BadExample.pm usr/share/man/man3/Acme::Bleach.3pm usr/share/man/man3/Acme::EyeDrops.3pm (so on so forth...)

So, it looks good. When megadistro hits a problem testing an application, it will interactively ask for forcing the install (Y/n). Could be a good idea to specify this as a parameter. It will also, or so it seems, download from the CPAN the dependencies.

Let us know if you try it too !


In reply to Repeated offline installs of same CPAN modules by carcassonne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.