build.dir = /usr/build product.dir = ${build.dir}/product #### # File contents build=/usr/local/build eval=evaluation full=distribution PRODUCTONE=${build}/${eval} PRODUCTTWO=${build}/${full}/Second #### VAR '1' = { 'build' => '/usr/local/build', 'eval' => 'evaluation', 'full' => 'distribution', 'PRODUCTONE' => '/usr/local/build/', 'PRODUCTTWO' => '/usr/local/build//Second', } #### #====================================================================== sub interpolateValues($) { my $self = shift; return unless defined($INTWeb::Properties::INTERPOLATE_VALUES); my $List = shift; foreach my $listKey (keys(%{$List})) { my $listValue = $List->{$listKey}; #print "|--+ $listKey: $listValue\n"; if ($listValue =~ m/\$\{(.*?)\}/) { my $extractedVariable = $1; my $defined = $self->isDefined($List, $extractedVariable); $defined += $self->isDefined($self->{Resolved}, $extractedVariable); die("FATAL: $extractedVariable is not a valid propery variable name\n") if($defined == 0); my $substituteThis = $extractedVariable; my $substituteWith = $self->{Resolved}->{$extractedVariable}; my $final = $List->{$listKey}; $final =~ s/(\$\{$extractedVariable\}/$substituteWith/; print "FINAL: $final\n"; } else { $self->{Resolved}->{$listKey} = $List->{$listKey}; delete ($List->{$listKey}); } } } sub isDefined { my $self = shift; my $hash = shift; my $key = shift; return defined($hash->{$key}); } #----------------------------------------------------------------------