note
dakkar
<p>I'd do it like this:</p>
<p>The INI</p>
<code>
[GENERAL]
scheduledb=something
[SERVICE]
start2=stuff ${GENERAL/scheduledb=default} etcetera
</code>
<p>The "getter":</p>
<code>
sub x_val {
my ($ini,$sect,$key,$def)=@_; # same signature as 'val'
my $val=$ini->val($sect,$key,$def);
my ($sect1,$key1,$def1,$t);
while ($val=~/\$\{([^}]+)\}/) {
$t=$1;
($sect1,$key1,$def1)=($t=~m|^([^/]+)/([^=]+)(?:=(.*))?$|);
$val=$`.(x_val($ini,$sect1,$key1,$def1)).$';
}
$val;
}
</code>
<p>Notes:
<ul>
<li>It uses pre- and post-match variables, so it will slow you regexps</li>
<li>The syntax is a bit different from the one you show</li>
<li>It expands recursively</li>
<li>It supports in-line defaults</li>
<li>I haven't tested it...</li>
</ul>
</p>
<pre>--
dakkar - Mobilis in mobile
</pre>
244581
244581