Pass $ref to functions
This commit is contained in:
parent
025e938354
commit
5257595639
1 changed files with 9 additions and 8 deletions
|
|
@ -239,13 +239,13 @@ sub compute ($$$;$$$)
|
||||||
{
|
{
|
||||||
$grade = $doc->createElement("grade");
|
$grade = $doc->createElement("grade");
|
||||||
$grade->addChild( $doc->createAttribute("factor", $self->{factor}) );
|
$grade->addChild( $doc->createAttribute("factor", $self->{factor}) );
|
||||||
$grade->addChild( $doc->createAttribute("name", $self->{title}) );
|
$grade->addChild( $doc->createAttribute("name", $self->{title}) ) if ($self->{title});
|
||||||
$parent->appendChild( $grade );
|
$parent->appendChild( $grade );
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $node (@{ $self->{tree} })
|
for my $node (@{ $self->{tree} })
|
||||||
{
|
{
|
||||||
my $t = $node->compute($operators, $ids, $doc, $grade);
|
my $t = $node->compute($operators, $ids, $login, $doc, $grade);
|
||||||
push @current, $t if (defined $t);
|
push @current, $t if (defined $t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -315,16 +315,17 @@ sub toString ($$$)
|
||||||
$parent->appendChild($point);
|
$parent->appendChild($point);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getValue ($$)
|
sub getValue ($$$)
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ids = shift;
|
my $ids = shift;
|
||||||
|
my $ref = shift;
|
||||||
|
|
||||||
# Return the point node value if exists
|
# Return the point node value if exists
|
||||||
return $self->{value} if ($self->{value} ne "");
|
return $self->{value} if ($self->{value} ne "");
|
||||||
|
|
||||||
# Else return pointed ref value
|
# Else return pointed ref value
|
||||||
return $ids->{ $self->{ref} };
|
return $ids->{ $ref };
|
||||||
}
|
}
|
||||||
|
|
||||||
sub compute ($$$;$$$)
|
sub compute ($$$;$$$)
|
||||||
|
|
@ -352,15 +353,15 @@ sub compute ($$$;$$$)
|
||||||
$result = !$result if ($self->{not});
|
$result = !$result if ($self->{not});
|
||||||
|
|
||||||
# ret is valued only if all conditions passed
|
# ret is valued only if all conditions passed
|
||||||
$ret = $self->getValue( $ids ) if ($result);
|
$ret = $self->getValue( $ids, $ref ) if ($result);
|
||||||
|
|
||||||
if ($main::debug)
|
if ($main::debug)
|
||||||
{
|
{
|
||||||
my $str = "not=".($self->{not}//0).", qversion".($self->{qversion}//"*").", ref=".($ref//"").",\tvalue=".($ids->{ $ref//"" } // "undef").", ";
|
my $str = "not=".($self->{not}//0).", qversion".($self->{qversion}//"*").", ref=".($ref//"").",\tvalue=".($ids->{ $ref//"" } // "undef");
|
||||||
if ($result) {
|
if ($result) {
|
||||||
say GREEN, ">>>", RESET, " Matching point: ", $str, BOLD, "got=".($ret // 0), RESET;
|
say GREEN, ">>>", RESET, " Matching point: ", $str, ", ", BOLD, "got=".($ret // 0), RESET;
|
||||||
} else {
|
} else {
|
||||||
say RED, " * ", RESET, " Skipped point: ", $str, BOLD, "got=".($ret // 0), RESET;
|
say RED, " * ", RESET, " Skipped point: ", $str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue