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

How to configure CPAN automatically?

by szabgab (Priest)
on Mar 17, 2015 at 06:38 UTC ( [id://1120273] : perlquestion . print w/replies, xml ) Need Help??

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

When on a newly compiled perl I try to run cpan it asks me if I want to automatically configure it. The thing is that I would like to eliminate even this question, just run the code and let it auto-configure itself. I tried yes | cpan but it got into an endless loop of
Refusing to autoload 'y' in recursion cpan[40953]> Refusing to autoload 'y' in recursion cpan[40954]> Refusing to autoload 'y' in recursion cpan[40955]>
Please, don't point me to cpanminus. I specifically need the cpan command.

Replies are listed 'Best First'.
Re: How to configure CPAN automatically?
by Anonymous Monk on Mar 17, 2015 at 07:22 UTC
      This ought to do it but it doesn't quite work for me , ignores the first arg, prompts for url list
      require CPAN::FirstTime; CPAN::FirstTime::init( 'GonerConfig.pm', autoconfig => 1 , );
Re: How to configure CPAN automatically?
by Anonymous Monk on May 09, 2016 at 19:38 UTC

    If you want multiple Enters, you can give the `yes` command a parameter of '' empty string.

    yes ''|cpan

    If you want just one Enter — as `cpan` only requires the first one to begin automatically deciding on the remainder of the prompts, you can just pipe in an `echo`.

    echo|cpan

    Alternatively, if you feed an empty pipe in, that also seems to work.

    cpan < /dev/null