Author: gozer
Date: Thu May 26 06:45:10 2005
New Revision: 178634

URL: http://svn.apache.org/viewcvs?rev=178634&view=rev
Log:
If running Makefile.PL unnatended (STDIN isn't a terminal or
MP_PROMPT_DEFAULT=1), break out of potentially infinite prompt
loops


Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/Makefile.PL

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=178634&r1=178633&r2=178634&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Thu May 26 06:45:10 2005
@@ -12,6 +12,10 @@
 
 =item 2.0.1-dev
 
+If running Makefile.PL unnatended (STDIN isn't a terminal or
+MP_PROMPT_DEFAULT=1), break out of potentially infinite prompt
+loops [Gozer]
+
 fix ModPerl::TestReport used by t/REPORT and mp2bug to use
 ExtUtils::MakeMaker's MM->parse_version to get the interesting
 packages version number, w/o trying to load them (which may fail if

Modified: perl/modperl/trunk/Makefile.PL
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Makefile.PL?rev=178634&r1=178633&r2=178634&view=diff
==============================================================================
--- perl/modperl/trunk/Makefile.PL (original)
+++ perl/modperl/trunk/Makefile.PL Thu May 26 06:45:10 2005
@@ -49,6 +49,8 @@
 my $build = Apache2::Build->new(init => 1);
 my $code  = ModPerl::Code->new;
 
+sub UNATTENDED() { $build->{MP_PROMPT_DEFAULT} || ! -t STDIN }
+
 win32_fetch_apxs() if WIN32;
 
 configure();
@@ -251,7 +253,7 @@
         }
         until ($ok) {
             my $ask = "Please provide the location of the Apache directory:";
-            my $ans = $build->prompt($ask);
+            my $ans = $build->prompt($ask) || "";
             # strip leading/closing spaces
             $ans =~ s/^\s*|\s*$//g;
             if (defined $ans and -d $ans) {
@@ -260,6 +262,7 @@
             }
             else {
                 error "Can't find dir '$ans'";
+                last if UNATTENDED;
             }
         }
     }
@@ -345,7 +348,7 @@
     my $prompt = "\nPlease provide a full path to 'apxs' executable\n" .
         "(press Enter if you don't have it installed):";
     while (1) {
-        my $ans = $build->prompt($prompt);
+        my $ans = $build->prompt($prompt) || "";
 
         print "\n\n";
 


Reply via email to