Skip to content

Commit

Permalink
need to skip values/value nodes here
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Nov 18, 2015
1 parent 36e9a9e commit 419dc93
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions utils/perl5lib/Config/ConfigCase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,26 @@ sub add_config_variables
# This creates a hash of values with attribute name and id as keys
#
if($node_name eq "values"){
foreach my $val_node ($define_node->findnodes(".//*")){
foreach my $val_node ($define_node->findnodes(".//value")){
if($val_node->hasAttributes()){
my @att = $val_node->attributes();
foreach my $attstr (@att){
my $att = $attstr->nodeName();
my $att_val = $attstr->getValue();
my $val = $val_node->textContent();
$val =~ s/\$MODEL/$model/;
$val =~ s/\$CIMEROOT/$cimeroot/;
if (-d $srcroot) {
$val =~ s/\$SRCROOT/$srcroot/;
}
$self->{$id}{$att}{$att_val} = $val;
my @att = $val_node->attributes();
foreach my $attstr (@att){
my $att = $attstr->nodeName();
my $att_val = $attstr->getValue();
my $val = $val_node->textContent();
$val =~ s/\$MODEL/$model/;
$val =~ s/\$CIMEROOT/$cimeroot/;
if (-d $srcroot) {
$val =~ s/\$SRCROOT/$srcroot/;
}
$self->{$id}{$att}{$att_val} = $val;
}
}
}
}

}else{
# we want to avoid the 'value' nodes which are children of 'values'
next if($node_name eq 'value' and $define_node->parentNode() ne $node);
my $node_value = $define_node->textContent();
if (defined $node_value) {
$node_value =~ s/\$MODEL/$model/;
Expand Down

0 comments on commit 419dc93

Please sign in to comment.