http://qs321.pair.com?node_id=244584


in reply to Substituting tokens into configuration values

I'd do it like this:

The INI

[GENERAL] scheduledb=something [SERVICE] start2=stuff ${GENERAL/scheduledb=default} etcetera

The "getter":

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; }

Notes:

-- 
        dakkar - Mobilis in mobile