6.0

Table Of Contents
vSphere SDK for Perl Programming Guide
28 VMware, Inc.
# Disconnect on receipt of an interrupt signal while in the infinite loop below.
$SIG{INT} = sub { Util::disconnect();
exit;
};
while (1) {
$log = $diagMgr->BrowseDiagnosticLog(
key => "hostd",
start => $start);
if ($log->lineStart != 0) {
foreach my $line (@{$log->lineText}) {
# next if ($line =~ /verbose\]/);
print "$line\n";
}
}
$start = $log->lineEnd + 1;
sleep 2;
}
Understanding Perl View Objects
AviewisaclientsidePerlobjectpopulatedwiththestateofoneormoreserversidemanagedobjectsbythe
vSphereSDKforPerl.Aviewobjecthasthefollowingcharacteristics:
Isastaticcopyofaserversidemanagedobjectandincludespropertiesandmethodsthatcorrespondto
thepropertiesandoperationsoftheserversidemanagedobject.
Mustbeexplicitlyupdatedwhentheobjectontheserverchanges.See“UpdatingViewObjects”on
page 32.
Haspropertiesthatcorrespondtopropertiesofserversidemanagedobjectsasfollows:
Foreachsimpleproperty(string,Boolean,numericdatatype),includinginheritedsimpleproperties,
theSDKcreatesanaccessormethod.Theaccessormethodnameisthesameasthepropertyname.
Arraysofpropertiesbecomearraysofpropertiesofthesamename.
Includesthesemethods:
Anaccessormethodforeachmanagedobjectproperty.ThevSphereSDKforPerlprovidesaccessors
foranyproperty,regardlessofitsdepthinsideacompositeobjectstructure.
Ablockingandanonblockingmethodforeach(nonblocking)operationprovidedbytheserverside
managedobject.See“NonBlockingandBlockingMethods”onpage 30.
Amethodthatupdatesthestateofanyclientsideviewobjectwithcurrentdatafromtheserver.See
“UpdatingViewObjects”onpage 32.
ThevSphereSDKforPerlsimplifiesprogrammingasfollows:
Providesa_thisparametertoreferencetheobjectonwhichamethodisrun,ifneeded.
Allowsyoutopassaviewobjectasaparametertomethodsthattakemanagedobjectreferencesas
requiredparameter.TheSDKconvertstheviewobjecttothecorrespondingmanagedobject.
Working with View Object Property Values
vSphereSDKforPerlviewobjectsarePerlobjects.Youcanretrieveaview,accessandmanipulateits
properties,andcallitsmethodsusingPerlsobjectorientedsyntax.
Accessing Property Values
Eachpropertyisdefinedasaspecificdatatypeandcanbeoneofthefollowing: