Skip to content

Commit

Permalink
Migrate the prompt bypassing code out of the 5.5+ Makefile generator
Browse files Browse the repository at this point in the history
and into the base Makefile.PL.  This is the code that skips
interaction if STDIN isn't a terminal, or if --default is specified.
  • Loading branch information
rcaputo committed Sep 5, 2004
1 parent 4e5a3b7 commit cfa4b9a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
30 changes: 30 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ use strict;
use ExtUtils::MakeMaker;
use Config;

# Switch to default behavior if STDIN isn't a tty.
unless (-t STDIN) {
warn(
"\n",
"====================================================================\n",
"\n",
"Assuming --default because standard input is not a terminal.\n",
"\n",
"====================================================================\n",
"\n",
);
push @ARGV, "--default";
}

unless (grep /^--default$/, @ARGV) {
warn(
"\n",
"====================================================================\n",
"\n",
"Prompts may be bypassed by running:\n",
" $^X $0 --default\n",
"\n",
"Only necessary modules will be installed by default.\n",
"\n",
"====================================================================\n",
"\n",
);
}


my $prompt = qq|
POE's test suite requires a functional network.
However, we can skip those tests requiring network
Expand Down
35 changes: 3 additions & 32 deletions mylib/Makefile-5005.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,28 @@
use strict;

use lib qw(./mylib);

use ExtUtils::MakeMaker;
use File::Find;
use File::Spec;

# Switch to default behavior if STDIN isn't a tty.
unless (-t STDIN) {
warn(
"\n",
"======================================================================\n",
"\n",
"Standard input is not a terminal/console. Reverting to --default\n",
"behavior to avoid the prompts.\n",
"\n",
"======================================================================\n",
"\n",
);
push @ARGV, "--default";
}

eval "require ExtUtils::AutoInstall";
if ($@) {
warn(
"\n",
"==================================================================\n",
"====================================================================\n",
"\n",
"POE's installer magic requires ExtUtils::AutoInstall. POE comes\n",
"with an older version, but it will not be installed. You should\n",
"install the most recent ExtUtils::AutoInstall at your convenience.\n",
"\n",
"==================================================================\n",
"====================================================================\n",
"\n",
);
eval "require './mylib/ExtUtils/AutoInstall.pm'";
die if $@;
}

unless (grep /^--default$/, @ARGV) {
print(
"\n",
"=================================================================\n",
"\n",
"If the prompts are annoying, they can be bypassed by running\n",
"\t$^X $0 --default\n",
"\n",
"Only necessary modules are installed by default.\n",
"\n",
"=================================================================\n",
"\n",
);
}

ExtUtils::AutoInstall->import(
-version => '0.50',
-core => [
Expand Down

0 comments on commit cfa4b9a

Please sign in to comment.