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

We're building a new linux box to replace several other boxes. I wrote code to roll up lists of CPAN modules on ten boxes, and I have a list of over two thousand unique module names (not taking REVS into account which would be an even longer list). The intent on the new box would be to have the UNION of all module names on all boxes which is this list.

The new box will have Perl 5.8.26 . I will toss out modules already on the new box which will cut down the list, but it will still be very long.

I wonder - is there a way to write a script that I can run with su to attempt to install all the modules?

TYVM all , your kind consideration of my dumbness is most appreciated!

Replies are listed 'Best First'.
Re: loading >>1 CPAN modules
by Fletch (Bishop) on Apr 29, 2022 at 18:49 UTC

    Right in the docs for CPAN there's the autobundle command which will write a special snapshot module of everything to install. You can toss this module file onto the new box and just install that and it'll install everything listed.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: loading >>1 CPAN modules
by choroba (Cardinal) on Apr 29, 2022 at 19:06 UTC
    Do you mean 5.8 or 5.26?

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: loading >>1 CPAN modules
by dsheroh (Monsignor) on Apr 30, 2022 at 11:33 UTC
    You have a list? Join all the lines into a single, space-separated line and put that on the cpan command line instead of running cpan as an interactive shell. Or maybe multiple lines, given that you have 2000 package names and a single line of that length may exceed your OS's/shell's limits, but that's still suitable for a shell script that just runs the cpan commands one after the other.

    cpan CPAN Foo::Bar Baz Xyzzy Acme::Frotz...

    You'll obviously also want to configure cpan to not ask questions about following dependencies and so forth before doing this, if that isn't how you normally have it configured in the first place.

      I'd suggest actually using App::cpm, which can install in parallel and is therefore much faster.