I wrote a quick script to do exactly this a while ago. There's nothing fancy about it, but it saved me a bunch of typing when I had to install the same set of modules on a handful of unix and linux machines.

I automated some of the modules' setup options that could be controlled by passing args or by supplying a config file. For the ones that prompted for input, I manually typed the input. Since I only did this on 4 or 5 machines and they were all different flavors of unix/linux with different perl versions, I also added a lot of prompts to my script so I could watch the progress and make sure it worked correctly.

Like I said, there's nothing special about my script, but it might be useful to you as a starting point. So, here it is, complete with comments about some modules that needed special handling:

####################################### #changes I should make to buildModules script: # -libwww: pass -n option to Makefile.PL # -Net::SSLeay: perl Makefile.PL /usr/local/openssl # -print out a warning telling you to build openssl, expat, and zlib + first ####################################### print "\n (Don't forget to build openssl, expat, and zlib first. Als +o see notes at the top of this script.)\n"; $perl = '/usr/newperl/bin/perl'; if ($^O eq 'aix') { $dir = '/export/home/joe/perl58source/modules'; } else { $dir = '/export/home/u1/jcullin/perl58source/modules'; } use File::Copy; my (@modules, $unpackOnly); # Optional args: # These are for when I want to test my changes for a specific # module, or for when I mess up a specific module and need to # redo it. if (@ARGV) { @modules = @ARGV; if (scalar @ARGV == 2 && $ARGV[1] eq 'unpack') { pop @modules; $unpackOnly = 1; } } # When run with no args, the script installs this list of modules: # else { # I think I remember tweaking the order of this list # in order to satisfy some dependencies. Too bad I # didn't bother commenting it... @modules = ('IO-stringy-2.108', 'YAML-0.35', 'Parse-RecDescent-1.94', 'Mail-IMAPClient-2.2.9', 'CGI.pm-3.00', 'Convert-ASN1-0.17', 'Digest-MD5-2.29', 'HTML-Tagset-3.03', 'HTML-Parser-3.31', 'Lingua-Ispell-0.07', 'URI-1.27', 'libnet-1.17', 'XML-Parser-2.31', 'MIME-Base64-2.20', 'MailTools-1.60', 'MIME-tools-5.411a', 'Net-Ping-2.30', 'Net_SSLeay.pm-1.22', 'IO-Socket-SSL-0.95', 'libwww-perl-5.69', 'XML-SAX-Base-1.02', 'Authen-SASL-2.04', 'perl-ldap-0.29', 'Hook-WrapSub-0.03', 'Date-Simple-2.04', 'Convert-TNEF-0.17', 'Compress-Zlib-1.22', 'IO-Zlib-1.01', 'Archive-Tar-1.05', 'Archive-Zip-1.06', 'MIME-Lite-3.01', 'Crypt-SSLeay-0.51', 'SOAP-Lite-0.55', 'DBI-1.38', 'NTLM-1.02', ); } # non perl modules, extra steps, etc.: @exceptions = ('expat-1.95.6', 'openssl-0.9.7c', 'zlib-1.1.4', ); # check directories first: die ("directory$dir doesn't exist.\n") if !-d $dir; if (!-d "$dir/temp") { mkdir "$dir/temp" || die ("directory$dir/temp doesn't exist.\n"); } die ("directory$dir/temp is not writable.\n") if !-w "$dir/temp"; for my $module (@modules) { if (&GetYesNoInput("Begin install of $module?") ne 'yes') { print "Skipping $module...\n\n"; next; } print "cleaning up temp directory...\n"; chdir $dir; system('rm -Rf temp/*'); print "unpacking $module files...\n"; my $copySuccess = copy ("$dir/${module}.tar.gz", "$dir/temp"); if (!$copySuccess) { print "failed copying ${module}.tar.gz to temp directory!!!\n" +; print "skipping ${module}...\n"; } chdir "$dir/temp"; system ("gzip -d ${module}.tar.gz"); system ("tar xvf ${module}.tar"); exit if $unpackOnly; # create empty config file for Net module: if ($module =~ /libnet/) { open (CONFIG, ">$dir/temp/${module}/libnet.cfg"); close CONFIG; } # MIME-tools .tar.gz file is named differently than the dir that i +t contains: $module =~ s/a$// if $module eq 'MIME-tools-5.411a'; my $makefileArgs; $makefileArgs = 'EXPATLIBPATH=/usr/footprints_perl/expat/lib EXPAT +INCPATH=/usr/footprints_perl/expat/include' if $module =~ /^XML-Parse +r/; print "Makefile.PL $makefileArgs...\n"; chdir "$dir/temp/$module"; system ("$perl Makefile.PL $makefileArgs"); print "make...\n"; system ("make"); print "make test...\n"; system ("make test"); if (&GetYesNoInput("Ok to continue with install of $module?") eq ' +yes') { print "make install...\n"; system ("make install"); } else { print "ok. skipping $module\n"; } } sub GetYesNoInput { my $prompt = $_[0]; print "\a"; # system bell print "\n"; print "$prompt\n"if $prompt; my ($correctYesNoInput, $yesNoInput, $yesNo); while (!$correctYesNoInput) { print "[Enter y or n.] \n"; $yesNoInput = <STDIN>; $yesNoInput =~ s/^\s*(.*?)\s*$/$1/; # trim whitespace my $lcInput = lc($yesNoInput); if ($lcInput eq 'y' || $lcInput eq 'yes') { $yesNo = 'yes'; $correctYesNoInput = 1; } elsif ($yesNoInput =~ /^n(o){0,1}$/i) { $yesNo = 'no'; $correctYesNoInput = 1; } } return $yesNo; }

In reply to Re: Automated module install by blahblahblah
in thread Automated module install by Tanktalus

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.