Re: [PATCH 3/5] Added config_default($key, $default) to Git.pm
- From
Jeff King <peff@peff.net>
- Date
- Nov 22, 2007, 12:14 UTC
- Message-ID
- <20071122121402.GF12913@sigill.intra.peff.net>
- In-Reply-To
- <20071122045552.30ca55c2@paradox.zwell.net>
On Thu, Nov 22, 2007 at 04:55:52AM -0600, Dan Zwell wrote:
Show 8 quoted lines
> Method returns a configuration value if defined, or the default
> value that was passed in, otherwise.
>
> The main purpose of this method is to allow the empty string to
> be a valid configuration option, and to replace the following
> construct:
>
> $val = $repo->config('my.key') || $default_valThe config subroutine does not currently take a third argument. Is there a particular reason not to make $repo->config('my.key', $default_val) the equivalent of config_default?
> +in situations where the empty string is an acceptable return value. > +This method may also be called in a vector context, when expecting
The term "vector context" is not commonly used. Most of the perl documentation calls it "list context" (try googling for each and seeing the hit numbers).
-Peff