Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

How to not Prompt when Installing a Module

by Anonymous Monk
on Oct 26, 2010 at 17:18 UTC ( [id://867507]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

When I run this command:
$ perl -MCPAN -e 'install Bundle::CPAN'
When it installs the underlying modules, it will ask me if I want them to be installed or not. For example, it will ask me this question: Shall I follow them and prepend them to the queue of modules we are processing right now? yes

My question is whether there is a way to disable this prompting so that it answers 'yes' all the time.

Replies are listed 'Best First'.
Re: How to not Prompt when Installing a Module
by Corion (Patriarch) on Oct 26, 2010 at 17:21 UTC

    See CPAN on prerequisites_policy, which you can change with:

    > cpan cpan> o conf prerequisites_policy follow
      Hi,

      Thank you for your suggestion. I made the change (see below). But it was still asking me the question "Shall I follow them..."
      prerequisites_policy [follow]
Re: How to not Prompt when Installing a Module
by shevek (Beadle) on Oct 26, 2010 at 18:45 UTC

    Bring up a CPAN shell:

    perl -MCPAN -e shell

    Run these two commands in the CPAN shell:

    o conf prerequisites_policy follow

    o conf commit

    You should exit and re-start the CPAN shell, and attempt to install a module. All dependencies should be automatically confirmed.

    You may still have to answer non-module install related questions-- such as connecting to the internet.

    Line 1 changes your dependency policy to follow instead of ask. Line 2 persists the change to your CPAN configuration file.

      Thanks. I did what you wrote. And still the problem exists. Is it possible that it will still ask that question if the module of a dependent module has dependencies?

        Can you specify which module? Also, you could turn off all questions by setting some env variables, but that only works if the modules are respecting the same vars.

        Also, can you share the message you are getting?

Re: How to not Prompt when Installing a Module
by bingos (Vicar) on Oct 26, 2010 at 23:16 UTC

    You can also set the following environment variables before running the cpan shell, which will avoid all questions, whether by the cpan shell or by modules you are installing

    export PERL_MM_USE_DEFAULT=1 export PERL_EXTUTILS_AUTOINSTALL="--defaultdeps" perl -MCPAN -e 'install Bundle::CPAN'

    You may be interested in App::cpanminus the new zero configuration CPAN client

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://867507]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found