]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 186337 - Param lookup should fall back to defaults
authorbbaetz%student.usyd.edu.au <>
Sun, 22 Dec 2002 07:39:48 +0000 (07:39 +0000)
committerbbaetz%student.usyd.edu.au <>
Sun, 22 Dec 2002 07:39:48 +0000 (07:39 +0000)
r=joel, a=justdave

Bugzilla/Config.pm

index 87d8c2dc1b2dcc96dc26f57d556defe7ad6defbf..190b11646627b7832d20a5a7c2af2e6aa78e2972 100644 (file)
@@ -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 {