diff options
author | Pascal Terjan <pterjan@mageia.org> | 2017-10-04 20:04:10 +0100 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2017-10-04 20:04:57 +0100 |
commit | 435e218e4dcc413e1d74f1ad39c7882de5b9b7ee (patch) | |
tree | 9947c81fe0a312b1ddf167b01333e584e0367aaf /lib | |
parent | 4542dfad9d493f42e8b9c1c2b2da476f0e7ff815 (diff) | |
download | iurt-435e218e4dcc413e1d74f1ad39c7882de5b9b7ee.tar iurt-435e218e4dcc413e1d74f1ad39c7882de5b9b7ee.tar.gz iurt-435e218e4dcc413e1d74f1ad39c7882de5b9b7ee.tar.bz2 iurt-435e218e4dcc413e1d74f1ad39c7882de5b9b7ee.tar.xz iurt-435e218e4dcc413e1d74f1ad39c7882de5b9b7ee.zip |
Allow overriding true config values with false
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Config.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Iurt/Config.pm b/lib/Iurt/Config.pm index 9a4ed8b..32b87e4 100644 --- a/lib/Iurt/Config.pm +++ b/lib/Iurt/Config.pm @@ -60,7 +60,7 @@ sub config_usage { print "\n\n"; } -=head2 config_init($config_usage, $config, $rung) +=head2 config_init($config_usage, $config, $run) Create an instance of a class at runtime. I<$config_usage> is the configuration help, @@ -75,7 +75,11 @@ sub config_init { foreach my $k (keys %$config_usage) { ref $config_usage->{$k}{default} eq 'CODE' and next; - $config->{$k} ||= $run->{config}{$k} || $config_usage->{$k}{default}; + if (defined($run->{config}{$k})) { + $config->{$k} = $run->{config}{$k}; + } elsif (!defined($config->{$k})) { + $config->{$k} = $config_usage->{$k}{default}; + } } # warly 20061107 # we need to have all the default initialised before calling functions, so this @@ -83,7 +87,11 @@ sub config_init { foreach my $k (keys %$config_usage) { ref $config_usage->{$k}{default} eq 'CODE' or next; my $a = $config_usage->{$k}{default}($config, $run); - $config->{$k} ||= $run->{config}{$k} || $a; + if (defined($run->{config}{$k})) { + $config->{$k} = $run->{config}{$k}; + } elsif (!defined($config->{$k})) { + $config->{$k} = $a; + } } } |