Have you considered using expect? Here is a sample expect script that will spawn the CPAN shell, answer "no" if appropriate during the configuration prompt, and quit when it sees the normal cpan> prompt. If the manual config prompt doesn't appear, the script will still catch it. This was written in the previous few minutes, so it can really be cleaned up and set to do something other than smartass remarks when something goes wrong; however it seems to do the job:
# 10 second time limit for one of our conditions to be met set timeout 10 eval spawn "/usr/bin/perl" "-MCPAN -e shell" expect { "Are you ready for manual configuration?" { send "no\r" } "cpan>" { send "quit\r" expect eof exit } timeout { puts "\nWe ran out of time\n" exit } eof { puts "\nOh noes, unexpected EOF\n" exit } } # This will only be reached if a default configuration keypress was re +quired expect "cpan>" send "quit\r"

In reply to Re: Automating CPAN Configuration by wsheehan
in thread Automating CPAN Configuration by dsheroh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.