6.5

Table Of Contents
vSphere SDK for Perl Programming Guide
56 VMware, Inc.
Returns
ReturnsaSOAP::SOMobjectthatcanbeusedtoeithercheckforerrors($result->fault)ortoparsethe
results($result->result).TheSOAPobjectincludesaheaderanddatainXMLformat.
PullRelease
AnoverloadedmethodthatperformsaPulloperationoraReleaseoperation.
Arguments
Acceptsthefollowingarguments:
Get
Retrievesaninstanceofaclass.
Arguments
Acceptsthefollowingnamedarguments:
WSMan::WSBasic Examples
ThissectionshowsafewcodeexamplesforWSMan::WSBasic.
Using Enumeration Modes
TouseoneoftheenumerationmodeslikeEnumerateEPRorEnumerateEPRandObject,calltheEnumerate
operationwithEnumerationModeenabled.Youcanalsospecifytheenumerationmodeintheconstructor.
$result = $client->Enumerate(class_name => 'CIM_Processor',
#namespace => 'root/cimv2', #if needed.
enummode => 'EnumerateEPR'
);
Registering Classes
Toperformoperationsonvendorspecificclasses,youmustregisterthemfirstwiththeclient.TheactualURL
dependsonyourWSManagementsoftware.
$client->register_class_ns(Linux => 'http://www.dmtf.org/linux');
Using Enumerate and Pull Operations
#!/usr/bin/perl -w
use strict;
use WSMan::WSBasic; #Import the module.
my ($enumid, result, $client); #declaring variables.
Argument Description
enumid EnumerationIDthatthePullorReleaseoperationshoulduse.Thisargumentispassedasastring.
action Specifiestheoperationtoperform,PullorRelease.Thisargumentispassedasastring.
namespace DefaultCIMnamespace.Defaultisroot/cimv2.
Ifthenamespaceisnotroot/cimv2,youmust
passinthenamespaceoftheclassinthisargument.
Argument Description
class_name Theclasswhoseinstanceyouwanttoretrieve.Thisargumentispassedasastring.
options PasseskeysfortheparticularinstanceonwhichyouwanttoperformaGetoperation.Passedasa
referencetoahashcontainingthekeysinnamevaluepairs.
namespace DefaultCIMnamespace.Defaultisroot/cimv2
.
Ifthenamespaceisnotroot/cimv2,youmustpassinthenamespaceoftheclassinthisargument.