Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

CPAN auto_bootstrap

by doc_faustroll (Scribe)
on Apr 13, 2006 at 23:39 UTC ( #543254=perlquestion: print w/ replies, xml ) Need Help??
doc_faustroll has asked for the wisdom of the Perl Monks concerning the following question:

This is mostly a wisdom question rather than a knowledge question as I certainly will work this one pipe problem out. Intent: I'm going to write a script that will be checked out by a developer who needs to bootstrap a Linux dev enviro:

When the developer runs the script, it will install any needed Perl modules, and then proceed to setup a working dev enviro complete with specific third-party executables and libraries auto-configured and at the ready. The script will use CPAN to install a bundle of my needed modules for the set_up_enviro script. CPAN will bootstrap itself as well.

It looks relatively straightforward for now:

My wisdom question is: What are the use of CPAN in a script current best practices and wisest design decisions for auto bootstrapping of both the Perl enviro and dev enviro? I don't want to tax or try anyone's precious time or patience with how do I do this or that questions which can easily be answered by reading the darn docs. If this intrigues anyone or if anyone has some wisdom or war stories that involve the kind of auto bootstrapping I'm tasking myself with, I'd appreciate your very generously gifted grey matter.

Example areas of question would be: for scripting, CPAN or CPANPLUS? why? any war stories?

canonical example of use of CPAN in a script is:

for $mod (qw(Net::FTP Digest::SHA Data::Dumper)){ my $obj = CPAN::Shell->expand(’Module’,$mod); $obj->install; }

Comment on CPAN auto_bootstrap
Download Code
Re: CPAN auto_bootstrap
by adamk (Chaplain) on Apr 15, 2006 at 06:59 UTC
    I think the one big problem you are going to face is that CPAN.pm itself is not yet auto-configurable.

    While we can probably make sensible choices for most of the normal options, the one big killer so far is mirror auto-selection.

    You'd need to write a module of some sort (and then bundle it into your script) that is able to deal with the problem of selecting the "best" mirror to use.

    This means some form of implementation of the logic needed to find some appropriate set of 10 or 20 mirrors from the 200 or so, find the ones that aren't out of date, then work out the top two or three fastest ones.
      Thanks for this reply. Good thinking and much appreciatied.

      I've thought of this issue, but I don't think I'm going to go so far as to work out the fastest ones. I also have the problem that some users might not be where I am in California and might actually be on other continents. I'll drop that as a requirement right away though. If they are in India, I'll have to ask them to run CPAN manually.

Re: CPAN auto_bootstrap
by barbie (Deacon) on Apr 15, 2006 at 18:14 UTC
    You might want to have a look at CPAN::YACSmoke as it does a lot wrapping around CPANPLUS. Although it only takes distributions to the test stage, you can manipulate CPANPLUS options to go the full distance, including auto-installing prerequisites rather than asking. You won't be able to use YACSmoke, but it might give you some pointers as to how to hook into CPANPLUS and some ideas of how to bundle a list of distributions to install.

    One thing to bear in mind is that just calling CPAN/CPANPLUS to install a module will look for the latest module distribution. This may not be suitable if you want to install with a known working environment. Using the YACSmoke method you are able to name specific distribution versions to install.

    --
    Barbie | Birmingham Perl Mongers user group | http://birmingham.pm.org/

      Thanks. I'll peek at it without installing it.

      CPANPLUS::Backend looks like the current best of breed for automating CPAN installs.

Reaped: samsung lcd tv
by NodeReaper (Curate) on Nov 22, 2006 at 06:04 UTC
Reaped: adjustable bed prices
by NodeReaper (Curate) on Nov 23, 2006 at 15:26 UTC
Reaped: bird humming
by NodeReaper (Curate) on Nov 24, 2006 at 16:14 UTC
Reaped: a620 canon powershot
by NodeReaper (Curate) on Nov 26, 2006 at 13:26 UTC
Reaped: 401 kenwood kmd sale
by NodeReaper (Curate) on Nov 27, 2006 at 22:14 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://543254]
Approved by ikegami
Front-paged by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-12-26 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (164 votes), past polls