diff options
| -rw-r--r-- | fml/lib/FML/Config.pm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/fml/lib/FML/Config.pm b/fml/lib/FML/Config.pm index ec022e4a..ce0be180 100644 --- a/fml/lib/FML/Config.pm +++ b/fml/lib/FML/Config.pm @@ -1,7 +1,7 @@ #-*- perl -*- # Copyright (C) 2000-2001 Ken'ichi Fukamachi # -# $FML: Config.pm,v 1.41 2001/10/10 03:10:10 fukachan Exp $ +# $FML: Config.pm,v 1.42 2001/10/10 14:53:45 fukachan Exp $ # package FML::Config; @@ -491,6 +491,30 @@ sub _expand_variables } +=head2 C<expand_variable_in_buffer($rbuf)> + +expand $varname to $config->{ varname } in C<$rbuf>. + +=cut + +# Descriptions: expand $varname to $config->{ varname } +# Arguments: $config $ref_buffer +# Side Effects: $ref_buffer is rewritten. +# Return Value: none +sub expand_variable_in_buffer +{ + my ($config, $rbuf) = @_; + + while ($$rbuf =~ /\$([\w\d\_]+)/) { + my $varname = $1; + if (defined $config->{ $varname }) { + my $x = $config->{ $varname }; + $$rbuf =~ s/\$$varname/$x/; + } + } +} + + =head2 C<yes( key )> useful method to return 1 or 0 according the value to the given key. |
