RESULT = $session->callPrimitive($primitiveName, @arguments)
Calls the specified Domain Manager primitive, passing the primitive the arguments and returning its result.
For most primitives, this is a complex invocation sequence. However, it is only actually needed when a primitive and a method of the InCharge::session module share the same name, and you wish to use the primitive version.
The following are equivalent, although the first is preferred.
@list = $session->getInstances( "Router" ); @list = $session->callPrimitive("getInstances", "Router");
The put() primitive is one of the few primitives where these two ways of calling it are not equivalent. This is because the InCharge::session module exports its own variant of the method. If you must gain access to the primitive version, you will need to use the callPrimitive() mechanism. However, this is not recommended, since the syntax is complex. The “put” on page 56 provides further details.
The type of the RESULT in array or scalar context is dependant on the primitive that is being called. In general:
-
If the primitive returns a scalar you get a scalar or, in array context, a single element array.
-
If the primitive returns an array you get an array, in array context, or array reference, in scalar context.