diff options
Diffstat (limited to 'lib/Iurt/Config.pm')
-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; + } } } |