views:

2267

answers:

8

How do I tell cpan to install all dependencies?

Edit:
After following Sinans link.
I tried setting these in cpan:

cpan> o conf prerequisites_policy follow
cpan> o conf commit

I still had to answer y a couple of times. (but fewer than before it feels like)

Any way to get it to always go ahead and install? I want to make it unattended.
Edit2:
It would seem that I want a flag to always trust cpan to do the right thing, if it suggests an answer I would like to follow it. (allway hit enter when it asks somthing)

+4  A: 

Set prerequisites_policy in the configuration.

See http://search.cpan.org/~andk/CPAN-1.9304/lib/CPAN.pm#Config_Variables

Sinan Ünür
Got me part of the way.
Nifle
Are the prompts related to downloading module source? If so, see **connect_to_internet_ok** option. Otherwise, tell us what other prompts you are trying to avoid.
Sinan Ünür
Well all basically, these last ones was "optional modules".
Nifle
The problem is things that auto-install on their own. CPAN.pm doesn't get a chance to handle that stuff. See tsee's answer.
brian d foy
+5  A: 

Maybe it's related to ExtUtils::AutoInstall or Module::AutoInstall being used. Try setting the PERL_AUTOINSTALL environment variable. (Cf. the documentation of those modules.)

tsee
That would be my guess.
Schwern
+2  A: 

Personally I have only tried a couple of times to modify the settings in that way and have actually found it easier to drop into the CPAN.pm shell by giving cpan no arguments, then configuring CPAN.pm from the interactive prompt:

$ cpan
cpan> o conf init

This will initiate the CPAN.pm interfaces configuration utility. Simply run through it and specify "follow" where you need to ( I forget the question offhand ) and you should be good to go.

Regards,

Jeff

numberwhun
A: 

I have not tried it, but can you use

yes | cpan [options]

in your scenario?

Anon Guy
Not all of the questions are looking for an answer of "yes"
brian d foy
+10  A: 

Try setting PERL_MM_USE_DEFAULT like so:

PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install My::Module'

It should make CPAN answer the default to all prompts.

kbosak
A: 

If you are already in a chain of endless dependencies installations, try "all" instead of "yes". I guess this is a temporal fix compared to the "o conf" approach.

Oliver Krüger
+1  A: 

Here's what I'm pretty sure you're looking for:

cpan> o conf prerequisites_policy follow
cpan> o conf commit
Mark C
+1  A: 

o conf build_requires_install_policy yes

This will change it from ask/yes to yes and stop it asking you.

sdf