diff options
author | bbaetz%student.usyd.edu.au <> | 2002-12-22 08:39:48 +0100 |
---|---|---|
committer | bbaetz%student.usyd.edu.au <> | 2002-12-22 08:39:48 +0100 |
commit | 607ff299e31f081c9690937bf0a4e88bd0214d60 (patch) | |
tree | c0625739ee98aa65157913f7f7179728401eda96 /Bugzilla | |
parent | eec74369a663d83f168b5cabad636bc89b3f0fd1 (diff) | |
download | bugzilla-607ff299e31f081c9690937bf0a4e88bd0214d60.tar.gz bugzilla-607ff299e31f081c9690937bf0a4e88bd0214d60.tar.xz |
Bug 186337 - Param lookup should fall back to defaults
r=joel, a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Config.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 87d8c2dc1..190b11646 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -121,9 +121,18 @@ sub Param { my ($param) = @_; # By this stage, the param must be in the hash - die "Can't find param named $param" unless (exists $param{$param}); + die "Can't find param named $param" unless (exists $params{$param}); - return $param{$param}; + # When module startup code runs (which is does even via -c, when using + # |use|), we may try to grab params which don't exist yet. This affects + # tests, so have this as a fallback for the -c case + return $params{$param}->{default} if ($^C && not exists $param{$param}); + + # If we have a value for the param, return it + return $param{$param} if exists $param{$param}; + + # Else error out + die "No value for param $param"; } sub GetParamList { |