[Koha-patches] [PATCH] added TRUST_ENV that tells to _get_value to *not* ask for a value if allready

jmf at arwen.metavore.com jmf at arwen.metavore.com
Mon May 12 17:18:06 CEST 2008


Hi Marc,

Are you sure this patch is required? The underlying MM::EU prompt()
should auto-detect when Makefile.PL is being run interactively or not
and will plug in the supplied default.

Also, not sure the goto as implemented isn't particularly perlish ;-)

Cheers,

Josh


On Fri, May 02, 2008 at 11:11:51PM +0200, Marc Chantreux wrote:
> (this permit, for exemple, a wrapper to the install script using dialog).
> ---
>  Makefile.PL |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile.PL b/Makefile.PL
> index bae8dbc..8d4e9fa 100644
> --- a/Makefile.PL
> +++ b/Makefile.PL
> @@ -1143,13 +1143,20 @@ sub _get_value {
>          return $install_log_values{$key};
>      }
>  
> +    my $val;
>      # override default value from environment
>      if (exists $ENV{$key}) {
> -        $default = $ENV{$key};
> -        $msg .= " (default from environment)";
> +	if (exists $ENV{TRUST_ENV}) {
> +	    $val = $ENV{$key};
> +	    goto VARSET
> +	} else {
> +	    $default = $ENV{$key};
> +	    $msg .= " (default from environment)";
> +	}
>      }
> +    $val = prompt($msg, $default);
>  
> -    my $val = prompt($msg, $default);
> +    VARSET:
>  
>      while (exists $valid_values->{$key} and 
>             $val ne $default and
> -- 
> 1.5.5
> 



More information about the Koha-patches mailing list