I do something similar to this on AIX, Sun, HP, Linux ... I can't exactly cut&paste the code, but I can give you an idea. So treat this not as untested code, but as pseudocode.

# get rid of env that you don't need, in case you're in another build +environment # (say it isn't using the same CC or make that perl used/uses) cleanup_environment(); # set up environment - bypass as many make-maker prompst as possible, $ENV{PERL_MM_USE_DEFAULT} = 1; # add the directory we're installing to to the PERL5LIB so we can find + them # after we install 'em. $ENV{PERL5LIB} = File::Spec->catdir($install_base, 'lib'); # I'm assuming the CPAN modules are somewhere local and already downlo +aded. chdir($modules_are) or die "Can't find CPAN modules"; my %tarballs = map { guess_package($_) => { tar => $_, # keep the original tarball name # extract the tarball to find out where the tarball is. dir => File::Spec->catdir($modules_are, extract_tarball($_)), } } grep { # remove your RCS directories/files... not /CVS/ and not /~$/ and # ... not is_module_installed($_) # maybe it's part of the core on this pl +atform already. } glob '*.tar*'; # loop through them, attempting to install each one. while (keys %tarballs) { my $count = scalar keys %tarballs; try_install($_) foreach keys %tarballs; # did we make progress? die "Can't meet any more pre-reqs" if $count == scalar keys %tarbal +ls; } exit 0; ### functions (not all are here - left as excersise for the reader) sub extract_tarball { my $tarball = shift; # figure out command based on extention... # e.g., /tar\.gz$/ => "gunzip -c $tarball | " # /tar\.Z$/ => "zcat $tarball | " # /tar$/ => "cat $tarball | " $cmd .= 'tar xf -'; open my $tar, "$cmd |" or die ...; while (<$tar>) { print; next if $subdir; $subdir = $1 if m{...}; # pull out the directory name being extrac +ted. } $subdir } sub try_install { my $module = shift; my $data = $tarballs{$module}; chdir $data->{dir}; if (-e 'Build.PL') { try_install_Build($data); } elsif (-e 'Makefile.PL') { try_install_Makefile($data); } else { die ... } delete $tarballs{$module} if $data->{installed}; }
There's lots more to do ... but that may give you an idea.


In reply to Re: Module management and multiple architectures by Tanktalus
in thread Module management and multiple architectures by suaveant

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.