Re: [Module::Build] PERL_MM_USE_DEFAULT
Status: Beta
Brought to you by:
kwilliams
|
From: Tyler M. <ty...@yi...> - 2006-01-19 18:02:46
|
Yitzchak Scott-Thoennes <sth...@ef...> wrote:
> I think _is_interactive should stay the same in how it is used in y_n,
> but prompt() should be made to work like EU::MM::prompt. This means
> skipping the read if PERL_MM_USE_DEFAULT is set, but actually trying
> to read even if not interactive, so an input file of responses can be
> given. This should do it:
I agree this makes more sense, but there's one problem. With your
change, it looks like if:
- PERL_MM_USE_DEFAULT is set,
- and y_n() is called without a default,
- *and* the session is attached to at terminal
then y_n will just loop forever. :-/
- Tyler
>
> --- Module-Build-0.27_05/lib/Module/Build/Base.pm.orig 2006-01-17 00:39:03.266454000 -0800
> +++ Module-Build-0.27_05/lib/Module/Build/Base.pm 2006-01-18 22:13:09.393200000 -0800
> @@ -358,7 +358,8 @@ sub prompt {
> print "$mess $dispdef";
> }
> my $ans;
> - if ($self->_is_interactive) {
> + if ( ! $ENV{PERL_MM_USE_DEFAULT} &&
> + ( $self->_is_interactive || ! eof STDIN ) ) {
> $ans = <STDIN>;
> if ( defined $ans ) {
> chomp $ans;
> --- Module-Build-0.27_05/lib/Module/Build/Authoring.pod.orig 2006-01-12 15:56:39.000000000 -0800
> +++ Module-Build-0.27_05/lib/Module/Build/Authoring.pod 2006-01-18 22:16:49.970374400 -0800
> @@ -1229,10 +1229,12 @@
> which is optional, specifies a default answer (for example,
> C<"wallet">). The user will be asked the question once.
>
> -If the current session doesn't seem to be interactive (i.e. if
> -C<STDIN> and C<STDOUT> look like they're attached to files or
> -something, not terminals), we'll just use the default without
> -letting the user provide an answer.
> +If C<prompt()> detects that it is not running interactively and there
> +is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable
> +is set to true, the $default will be used without prompting. This
> +prevents automated processes from blocking on user input.
> +
> +If no $default is provided an empty string will be used instead.
>
> This method may be called as a class or object method.
>
>
> The doc paragraphs are taken verbatim from makemaker.
>
> Hope this sounds ok,
> Yitzchak (who's starting to wonder if Ken is on vacation)
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Module-build-general mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/module-build-general
>
|