All the functions described in this document must be invoked with reference to a valid object of the InCharge::session module. These object references are created by using InCharge::session->object(), InCharge::session->create(), or InCharge::session->getInstances().

The general approach used for calling primitives is as follows:

  1. Initialize a session and obtain a reference to it.

      $session = InCharge::session->init( );
  2. Call the primitives required, by using the session reference. For example:

      foreach $class ( sort $session->getClasses() ) {
       foreach $inst (
        sort $session->getInstances($class)) 
        print $class . "::" . $inst . "\n”;
  3. Close the session.

      $session->detach( );

    Where access to operations or properties of Domain Manager repository objects is required you are discouraged from using the get(), put() and invokeOperation() primitives, but encouraged to use the features of the InCharge::object module instead. Using this approach, the script obtains an InCharge::object reference, which is used to access the required information. For example,

  4. Establish a session.

      $session = InCharge::session->init();
  5. Create an InCharge::object valid reference to the object of interest.

      $obj = $session->object( "Router::gw1" );
  6. Manipulate the object by using the reference.

      $type = $obj->{Type};
      $obj->{Vendor} = "Cisco";
      $fan1 = $obj->findFan( 1 );
  7. Close the session.

      $session->detach( );