Re: [Module::Build] ask() and you will receive
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <ml...@th...> - 2006-04-10 07:49:36
|
Ken Williams wrote: > I think this is a decent direction. I only have a couple of concerns: > one, I do think that the default needs to be one of the options in an > option list, or else people are just going to make too many mistakes. I debated that decision for a while. The reason I allowed it was that when running an unattended build, none of the choices may be a reasonable default. In that case the default can be set to an empty string or something that make sense to indicate that no choice was made. Note also that 'default' may be set to an empty string or to any value, including undef as long as something is passed in. One alternative I can think of: $answer = Prompter->ask( prompt => "What is your favorite programming language?\n", options => [qw(Perl Ruby Lua Python C C++ /unknown/)], default => 'unknown', ); Another element is added to 'options' enclosed between slashes (or something). Such elements would not be show when options are displayed. Then default can be set to the "invisible" option. > Two, maybe we can come up with a better name, just because I don't like > classes that end in "er". Actually, I intended this code to be in Module::Build::Base. I just extracted it to make it easy to review. So actual usage would be: use Module::Build my $mb = Module::Build->new(...); $mb->ask(...); -or- Module::Build->ask(...); Randy. |