summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Config.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-03-12 08:36:45 +0000
committerfukachan <fukachan>2004-03-12 08:36:45 +0000
commit0440fab47ffddd45c8a48c55426ecf038e7c9014 (patch)
tree0ad07aa20ade294ef888b703e24290eb405555a3 /fml/lib/FML/Config.pm
parent53f9776c138ae7ad5f1a7e7726c623ab6ae6a279 (diff)
downloadfml8-0440fab47ffddd45c8a48c55426ecf038e7c9014.tar.gz
fml8-0440fab47ffddd45c8a48c55426ecf038e7c9014.tar.bz2
fml8-0440fab47ffddd45c8a48c55426ecf038e7c9014.zip
bug fix yes() and no() method.
support shell like extension ${variable:-default}.
Diffstat (limited to 'fml/lib/FML/Config.pm')
-rw-r--r--fml/lib/FML/Config.pm23
1 files changed, 18 insertions, 5 deletions
diff --git a/fml/lib/FML/Config.pm b/fml/lib/FML/Config.pm
index ff5e98cb..b8cd2835 100644
--- a/fml/lib/FML/Config.pm
+++ b/fml/lib/FML/Config.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Config.pm,v 1.90 2004/02/01 06:38:34 fukachan Exp $
+# $FML: Config.pm,v 1.91 2004/02/15 04:38:25 fukachan Exp $
#
package FML::Config;
@@ -761,6 +761,19 @@ sub __expand_special_macros
$config->{ $x } =~ s/READ_ONLY\((.*)\)/$v/;
}
+
+ if ($config->{ $x } =~ /\$\{([a-z0-9_]+):-([a-z0-9_]+)\}/) {
+ my ($var, $default) = ($1, $2);
+
+ print STDERR "\${$var:-$default} => " if $debug;
+
+ $config->{$x} =~
+ s/\$\{([a-z0-9_]+):-([a-z0-9_]+)\}/(defined $config->{$1} ?
+ $config->{$1} :
+ $default)/ge;
+
+ print STDERR $config->{$x}, "\n" if $debug;
+ }
}
@@ -826,8 +839,8 @@ sub yes
{
my ($self, $key) = @_;
- if (defined $_fml_config{$key}) {
- $_fml_config{$key} =~ /^yes$/i ? 1 : 0;
+ if (defined $_fml_config_result{$key}) {
+ $_fml_config_result{$key} =~ /^yes$/i ? 1 : 0;
}
else {
0;
@@ -843,8 +856,8 @@ sub no
{
my ($self, $key) = @_;
- if (defined $_fml_config{$key}) {
- $_fml_config{$key} =~ /^no$/i ? 1 : 0;
+ if (defined $_fml_config_result{$key}) {
+ $_fml_config_result{$key} =~ /^no$/i ? 1 : 0;
}
else {
0;