$obj = $session->object( $objectname );
Creates a new InCharge::object reference that can be used to invoke methods of the InCharge::object module.
As an example, to obtain the value of the Vendor field for a particular object, use:
$obj = $session->object( "::gw1" ); $vendor = $obj->{Vendor};
You can even combine these into a single line, such as:
$vendor = $session->object( "::gw1" )->{Vendor};
The $objectname parameter can be specified in any of the styles shown in the following examples:
-
object( 'Router::gw1' )
In this example, the $objectname parameter is a single string where both the class and instance names are specified with double colons (::) delimiting them. If variables are to be used to specify the relevant parts of the string, then it is important that at least the variable before double-colon (::) is encased in braces because without them, Perl will give the (::) characters its own meaning.
-
object( 'Router', 'gw1' )
In this example, the $objectname parameter is specified as two strings with one for the class and one for the instance name.
-
object( '::gw1' )
In this example, the $objectname parameter is specified as one string with the class name missing. The API will make a query to the Domain Manager to discover the actual class for the object which causes a minor performance penalty.
-
object( undef, 'gw1' )
In this example, the $objectname parameter is specified as two parameters with the first one undefined. This also results in the API performing a Domain Manager query.
-
object( 'gw1' )
In this example, the $objectname parameter is specified as a single parameter that does not include the double-colon (::) delimiter, which must contain just the instance name. A Domain Manager query is performed to determine the relevant class name.
An important difference between the API and the native ASL language is that if you create an object, using object(), in native ASL without specifying the class name, the language assumes that the class MR_Object can be applied. This restricts the level of property and operation access that can be used. The API queries the repository to determine the actual class for the instance, giving complete access to the resulting object's features.