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

Hi, This is a generic question not specific to MIME::Lite.

I have a script that installs CPAN modules automatically and redirects all the CPAN output to a file (since they are huge). Now since all output is redirected to a file, user can't see any prompt that is thrown by CPAN installer and hence it will appear as the process has stuck forever.

So, is there a way to bypass questions like this (or any other user prompt for that matter):

MIME::Lite is designed to take advantage of a variety of external modu +les if they are not present then MIME::Lite will attempt to do its be +st but its strongly recommend that you install them. These modules are: MIME::Types Mail::Address I can add these modules to the prereq list which will cause the files +to be automatically installed if they aren't already present Add prereqs? [Yes]
by setting some configuration in CPAN so that it always takes the answer as either yes or no.

I have tried setting 'o conf prerequisites_policy follow' but these prompts are not bypassed with that configuration. It only bypass dependency installation prompts.

The above prompt is not for dependency installation but for recommended installation.

Any help in this regard is highly appreciated.
  • Comment on how to bypass the user prompts asked during cpan module installations
  • Download Code

Replies are listed 'Best First'.
Re: how to bypass the user prompts asked during cpan module installations
by Anonymous Monk on Feb 03, 2012 at 07:45 UTC
Re: how to bypass the user prompts asked during cpan module installations
by roboticus (Chancellor) on Feb 03, 2012 at 10:53 UTC

    prashanttekriwal:

    If you're on a unix box, you might use the script command. It's great for this sort of thing.

    It opens another command shell, and logs everything input and output to the file you specify. So you get the convenience of an interactive session, plus a complete log of everything displayed and entered.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re: how to bypass the user prompts asked during cpan module installations
by CountZero (Bishop) on Feb 03, 2012 at 14:33 UTC
    cpanm MIME::Lite installed the module without asking any questions and without hanging.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      does cpanm has any perl api. something like CPAN.pm for cpan, that can be used inside Perl script. Instead of using system level tool like cpanm.
        There is no perl API for cpanm. Its only access is through its system level script. It does one thing only (installing Perm modules), but it does it well.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James