RESULT = $session->invoke($object, $operation[, @arguments]);
It is not recommended that this method be used extensively. Instead, use the features of InCharge::object.
This method invokes the specified object operation, passing it the listed arguments and returning the RESULT.
The type of the RESULT depends on the usual Perl concept of array or scalar context, as well as the definition of the operation being called. In general:
If it returns a scalar you get a scalar or, in array context, a single element array.
If it returns an array you get an array, in array context, or array reference, in scalar context.Note:
This method's semantics and syntax differ from the primitive method invokeOperation() in that the latter needs to have the types of the arguments specified explicitly. Whereas for this method, the InCharge::session module version discovers and caches the operation argument types and does not require the arguments to be listed in arrays of array references.
Additional documentation about the operations that exist for a particular class can be obtained by using the dmctl utility, as shown:
dmctl -s DOMAIN getOperations CLASSNAME
The following examples are equivalent; the first example is preferred.
$obj = $session->object( "Router::gw1" ); $fan= $obj->findFan( 2 );
$fan = $session->invoke( "Router::gw1", "findFan", 2 );
$fan = $session->callPrimitive( "invokeOperation","Router", "gw1", "findFan",[ [ "INT", 2 ] ] );