The vSphere SDK for Perl runtime maps server-side operations to client-side Perl view object methods. For each operation defined on a
server managed object, the vSphere SDK for Perl creates a corresponding view method when it creates the view object.
All server-side operations available in the vSphere API are non-blocking operations listed in the vSphere API Reference Guide. The vSphere SDK for Perl provides a non-blocking method corresponding to the server-side operation, and also provides a blocking (synchronous) method (<
opname>() method).
See the vSphere API Reference Guide for lists of all operations for each managed object.
After you have retrieved the view object that corresponds to a managed object, you can run methods on that view to make use of the managed object’s services. You run a method by specifying the method’s
name parameter, for example:
The type of parameter required by the method depends on the operation defined in the vSphere API. It might be a simple type, data object, or managed object reference. For information about specific parameters and data types, see the
vSphere API Reference Guide.
You can execute any operation that is defined for a managed object as a method on a corresponding view object. Because the vSphere SDK for Perl creates an accessor and a mutator method (getter and setter method) for each property defined in the managed object, you can reference the name of any property as a method call of the view, for example:
The vSphere SDK for Perl allows you to pass a view object to a method that requires a ManagedObjectReference. For example, if you have the view that represents a host (
$host), you can pass the view to the
powerOn() method as follows:
Supplying undef as the value of the optional argument is useful when the value of an argument, which might or might not be
undef, is contained in a variable, as in the following example: