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).
■ Non-blocking methods – Asynchronous methods that return control to the client immediately after invocation and return a task object to the calling program. Non-blocking methods allow you to monitor progress (of the *_Task object) outside the main processing logic of the script. This monitoring can be useful during long-running operations. These methods also allow you to interleave local (client-side) processing and server-side processing.
■ Blocking methods – Synchronous methods that fully process the operation before returning control to the client script. Does not return a reference to a task object.If you use a blocking method, you do not have to handle a task object with additional code.The following table lists some of the operations available for a VirtualMachine managed object.
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.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:
Note Specifying Untyped Arguments in Scheduled Tasks and Callbacks discusses using the vSphere SDK for Perl PrimType structure in some calls.
■ You can supply undef as the value of the optional argument: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:You cannot use the empty string or the value 0 to represent undef or an unset parameter.