Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Automating CPAN Configuration

by Withigo (Friar)
on May 11, 2006 at 06:20 UTC ( #548613=note: print w/replies, xml ) Need Help??

in reply to Automating CPAN Configuration

Once upon a time I had to do almost the exact same. What I ended up doing is by no means elegant, but it did work for a couple dozen or so separate hosts, all of which could have been running different os'es and perl versions. Hundreds of modules were automatically installed on each host without any problems. (Excepting modules which themselves required manual input to install, but they all had environmental variables which could be provided to automate any prompts).
# get the location of export PREFIX=`perl -V:privlib` ${PREFIX##"privlib="} # force CPAN::FirstTime to not default to manual # setup, since initial CPAN setup needs to be automated perl -pi -e'$. == 73 and s/yes/no/' $PREFIX/CPAN/ # make CPAN set itself up with defaults and no intervention perl -MCPAN -MCPAN::Config -MCPAN::FirstTime -e'CPAN::FirstTime::init' # undo the change perl -pi -e'$. == 73 and s/no/yes/' $PREFIX/CPAN/
Now that CPAN is prepared for use the `PERL_MM_USE_DEFAULT=1 perl` etc... should work. I also distributed a pre-written to all hosts; but you say you'd like to avoid doing that, so this may not work perfectly without also providing your own I do remember that my only added a couple values, as almost all of the default values worked just fine. Unfortunately I've forgotten which values I needed to add, but a few minutes of trial and error would reveal them. The previous comment about setting $CPAN::Config->{urllist} would be one way of setting those values. Good luck!

Replies are listed 'Best First'.
Re^2: Automating CPAN Configuration
by dsheroh (Prior) on May 11, 2006 at 15:16 UTC
    I'm not really against distributing a pre-configured to each host, it just appears that, to do so, I would need to check the remote perl version to determine where to put it and, once I'm to the point of calling perl -v, parsing its output, building the right path, and putting there, then it would be simpler and more reliable to just fire up the CPAN shell, say "no" if it asks about manual config, and then exit from it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://548613]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2018-05-23 17:51 GMT
Find Nodes?
    Voting Booth?