Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

simpler way to silence modules that ask install-time questions

by perrin (Chancellor)
on Feb 19, 2009 at 20:31 UTC ( #745187=perlquestion: print w/replies, xml ) Need Help??

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

Some modules (e.g. URI, LWP) ask questions during their install, which makes it a pain to install them with a script. In the past I've solved this by using Expect, but I wonder if anyone knows a simpler way to shut these chatty modules up during a non-interactive install.
  • Comment on simpler way to silence modules that ask install-time questions

Replies are listed 'Best First'.
Re: simpler way to silence modules that ask install-time questions
by merlyn (Sage) on Feb 20, 2009 at 00:17 UTC
Re: simpler way to silence modules that ask install-time questions
by moritz (Cardinal) on Feb 19, 2009 at 20:38 UTC
    Since I use Debian I build Debian packages from them (unless they already exist, of course) with dh-make-perl. The resulting packages can be installed painlessly without any interactions. Similar systems exist for other distributions as well.

    That said some modules also can be silenced with environment variables that you have to set before you install them.

Re: simpler way to silence modules that ask install-time questions
by ikegami (Patriarch) on Feb 19, 2009 at 20:39 UTC
    I was going to look if there was a method specific to those distributions — there could be an argument or an environment var — but neither URI nor LWP ask questions during build, test and install?!

    I checked the installer sources.
    I built, tested and installed on Debian.
    I built, tested and installed on Windows.

    Update: Specified how I came to my finding.

      URI was a mistake. When I run the Makefile.PL for LWP though, it asks me if I want to install lwp-request. (Maybe you already have it.) This can be suppressed with a -n option. However, there are others that do this kind of chatting, and it would be nice to have a solution that works even when they don't provide their own bypass switch.

        I think the current LWP doesn't ask anymore. If a module is well-behaved, it will use ExtUtils::MakeMaker::prompt, which knows when a user is at the terminal and when not. There are badly behaved modules, like (I think) Apache::Request, which will enter a potentially infinite loop asking forever (and again) for the location of httpd. Those modules are badly programmed and nothing short of solving the halting problem will provide a general solution for these.

        If you're really interested in an evolving solution, have a look at andk's Distroprefs. He maintains snippets of Expect or other canned behaviour, like answers, patches or settings for many distributions, and you can maintain your private set as well, yourself. They get (almost) automatically integrated into your run of the cpan shell.

Re: simpler way to silence modules that ask install-time questions
by djp (Hermit) on Feb 19, 2009 at 23:42 UTC
    Here's a few things you can try:
    PERL_MM_USE_DEFAULT=1; export PERL_MM_USE_DEFAULT AUTOMATED_TESTING=1; export AUTOMATED_TESTING perl Makefile.PL < /dev/null make < /dev/null make test < /dev/null make install < /dev/null
    or similar, 'man CPAN' for details. I don't recall where I got AUTOMATED_TESTING from.
    (Later) See http://wiki.cpantesters.org/wiki/CPANAuthorNotes for AUTOMATED_TESTING.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2023-12-10 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?