Re: [Module::Build] PERL_MM_USE_DEFAULT
Status: Beta
Brought to you by:
kwilliams
|
From: Yitzchak Scott-T. <sth...@ef...> - 2006-01-20 09:04:31
|
On Thu, Jan 19, 2006 at 05:41:21PM -0800, Tyler MacDonald wrote:
> Yitzchak Scott-Thoennes <sth...@ef...> wrote:
> > Without it, the build is going fail for the first person who
> > runs with </dev/null (in the existing code) or PERL_MM_USE_DEFAULT=1
> > (with my patch to prompt()).
> >
> > Might as well force the module author to not make this mistake.
>
> True... we're *almost* there; I'd change this:
>
> die "y_n() called without y or n default" unless ($_[1]||"")=~/[yn]/i;
>
> To:
>
> die "y_n() called without y or n default" unless ($_[1]||"")=~/^[yn]/i;
Sigh. The carat was there when I wrote that; my mailer must have eaten
it along the way, and somehow got the one in the Base.pm I edited too :)
--- Module-Build-0.27_05/lib/Module/Build/Base.pm.orig 2006-01-18 22:13:09.393200000 -0800
+++ Module-Build-0.27_05/lib/Module/Build/Base.pm 2006-01-19 23:27:54.418640000 -0800
@@ -379,6 +379,7 @@
sub y_n {
my $self = shift;
die "y_n() called without a prompt message" unless @_;
+ die "y_n() called without y or n default" unless ($_[1]||"")=~/^[yn]/i;
my $interactive = $self->_is_interactive;
my $answer;
@@ -386,7 +387,6 @@
$answer = $self->prompt(@_);
return 1 if $answer =~ /^y/i;
return 0 if $answer =~ /^n/i;
- die "No y/n answer given, no default supplied, and no user to ask again" unless $interactive;
print "Please answer 'y' or 'n'.\n";
}
}
|