Re: [Module::Build] ask() and you will receive
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <ml...@th...> - 2006-04-20 00:08:54
|
Ken Williams wrote:
>
> On Apr 14, 2006, at 4:44 AM, Randy W. Sims wrote:
>
>> +
>> +=item default [required]
>> +
>> +This is the default value that will be used if the user presses
>> +E<lt>enterE<gt> or if running an unattended build.
>> +
>> +The value assigned to C<default> may be different from the options
>> +listed in the C<options> argument.
>
> I think I'm about to blaspheme, but I think sometimes we shouldn't
> require there to be a default.
>
> /me ducks
>
> Sometimes there's simply no way to build & test & install a module
> without user intervention. For example, Inline::Java asks you to tell
> it where the J2SDK installation is, and there's no default.
>
> If we changed the error message to something appropriate, I think we
> could handle this case gracefully, both here and in y_n(). Something like:
>
> if ( $ENV{PERL_MM_USE_DEFAULT} && !$def ) {
> die <<EOF;
> ERROR: PERL_MM_USE_DEFAULT is in effect, but there is no default value.
> Aborting.
> EOF
> }
>
> It might be nice to note this fact in the META.yml file, using a flag
> like 'interactive_install' or something, so that automated testers don't
> even try to download & build the distro.
>
> For a distro that really requires interaction like this, the author
> could work around our proposed required 'default' by setting 'default'
> to undef and then die()ing with their own error message if prompt() or
> y_n() or ask() returned undef, but why not provide them with the
> appropriate sugar?
Here's a rough rough patch to implement something along those lines, I
think. Rough day, my brains not working well, and somehow this simple
little input routine has become one of the largest routines in M::B, so
I'd appreciate feedback. All names, behaviors, and every last byte
subject to change.
Randy.
|