Step 4: Obtain View
Objects of Server-Side Managed Objects
When you call the subroutines in the
Vim
package to retrieve entities from the host, the
vSphere SDK for Perl runtime creates the corresponding Perl objects (view
objects) locally.
Sample Script (Commented Version)
uses the
Opts::get_option()
subroutine to
assign to
$entity_type
the string value of the parameter that the
user passes in when executing the script.
Sample Script (Commented Version)
then uses
$entity_type
as the
view_type
parameter in the subsequent call to
Vim::find_entity_views()
.
# get all inventory objects of the specified type my $entity_type = Opts::get_option('entity'); my $entity_views = Vim::find_entity_views(view_type => $entity_type);
The
Vim::find_entity_views()
subroutine creates a local Perl object (an array of references) from the
server-side managed object of the specified entity type.
This object is static and must
be explicitly updated when the corresponding server-side object changes.