KBEC-00151 - Passing actual parameters to runProcedure in a Perl module

Summary

This article discusses how to pass actual parameters to runProcedure in a Perl module.

Solution

This code executes a procedure that is contained in a Schedule. First it
retrieves the Parameters from the Schedule, adds them to a parameter list,
and then passes the list in the call to runProcedure.

#
# Execute a Procedure based on the Schedule to detect changes
#
# Params:
# projectName
# scheduleName
#
# Returns:
# The name of the procedure that it executed
#
sub ExecuteOneSchedule
{
    my ($projectName, $scheduleName) = @_;
    my @parameterList;
 
    # Retrieve the Entire Schedule
    my $xPath = InvokeCommander("SuppressLog", "getSchedule",
                                $projectName, $scheduleName);
 
    # Add each Actual Parameter to a list of hashes
    my $nodeset = $xPath->find('//actualParameter');
    foreach my $node ($nodeset->get_nodelist)
    {
        my $actualParameterName = $xPath->findvalue('actualParameterName', $node);
        my $actualParameterValue = $xPath->findvalue('value', $node);
        push (@parameterList, {"actualParameterName" => $actualParameterName,
              "value" => $actualParameterValue});
    }
 
    # Run the procedure
    my $procedureName = $xPath->findvalue('//procedureName');
    $xPath = InvokeCommander("SuppressLog", "runProcedure",
                             $projectName, $procedureName,
                             {"scheduleName" => $scheduleName,
                             "actualParameter" => \@parameterList});
 
    return $procedureName;
}

Applies to

  • Product versions: All 
  • OS vesions: All
Have more questions? Submit a request

Comments

Powered by Zendesk