Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

CPAN auto_bootstrap

by doc_faustroll (Scribe)
on Apr 13, 2006 at 23:39 UTC ( [id://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; }

Replies are listed 'Best First'.
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-03-28 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found