PslFunctionCall()

Call a PSL built-in function indirectly.

Syntax

PslFunctionCall(function_name , [arg1,arg2, ... argN]);

Parameter

Parameter

Definition

function_name

Name of a PSL built-in function to be called. User-defined functions are not supported.

argN

Arguments to be passsed to the PSL built-in function

Description

This function invokes the specified built-in PSL function with the specified arguments. It is equivalent to calling the function directly but provides an additional level of indirection. This is useful when using functions which might not be available on all agents, or useful when additional programmatic control is required to determine which function should be called. 

The PslFunctionCall() returns whatever the specified PSL built-in function returns. The PSL errno variable is also manipulated by the specified function as if called directly. PslFunctionCall() will determine if the specified function exists and if the correct number of arguments have been supplied before attempting to invoke the specified function. If the specified function can not be invoked the empty string is returned and PSL errno is set to E_BAD_PSLFUNCCALL_ERROR(143).

Note

PslFunctionCall() only calls PSL built-in functions. User-defined functions are not supported. 

Example

The following PSL statements demonstrate the use of PslFunctionCall to fall back to an alternate code path when a function call fails.

my_string = PslFunctionCall ( "str_repeat", "test", 10 );
if ( errno == 143 ) {
#str_repeat() not available on this agent
#or wrong number of arguments given
#construct the string another way
for ( i = 1 ; i <= 10; i++ ) {
my_string = my_string . "test";
}
}
print ( my_string . "\n");

Note

For additional ways of controlling execution based on available built-in PSL functions, see PslFunctionExists()


Was this page helpful? Yes No Submitting... Thank you

Comments