6.5

Table Of Contents
VMware, Inc. 41
4
ThevSphereSDKforPerlareavailableinthreepackages:
TheOptspackageincludessubroutinesforhandlingbuiltinoptionsandcreatingcustomoptions.See
“SubroutinesintheOptsPackageonpage 42.
TheUtilpackageincludessubroutinesforfacilitatingroutinetaskssuchassettingupandclosing
connectionstotheserver.See“SubroutinesintheUtilPackageonpage 43.
TheVimpackageincludessubroutinesforaccessingserversidemanagedobjects,instantiatinglocalview
objects,updatingproperties,andrunninglocalmethodstorunoperationsonremoteservers.
vSphere SDK for Perl Subroutine
Reference
4
Table 4-1. Subroutines in the Opts Package
Subroutine Description
add_options Enablescustomoptionstobeparsedandvalidatedforexecutioninthecontextofthescripttowhichthe
optionshavebeenadded.
get_option Retrievesthevalueofaspecifiedbuiltinorcustomoption.
option_is_set Checkswhetheranoptionhasbeenexplicitlysetbyascriptorfromthecommandline
orwhetherthe
optionhasadefaultorcomputedvalue(thatis,thereturnvalueofafunc).
parse Readsoptionsfromthecommandline,anenvironmentvariable,oraconfigurationfileandtransforms
themintoappropriatedatastructuresforvalidation.
validate Ensuresthatinputvaluesarecomplete,consistent,andvalid.
usage Displays
ahelptextmessage.
Table 4-2. Subroutines in the Vim Package
Subroutine Description
clear_session Terminatesthecurrentsessionloadedbytheload_session()subroutine.
find_entity_view Searchestheinventorytreeforamanagedobjectthatmatchesthespecifiedentitytype.
find_entity_views Searchestheinventorytreeformanagedobjectsthatmatchthespecifiedentitytype.
get_service_instance RetrievesaServiceInstanceobject,whichcanbeusedtoquerytheserver
timeortoretrievethe
ServiceContentobject.
get_service_content Retrievespropertiesoftheserviceinstance,enablingaccesstotheservice’smanagedobjects.
get_session_id RetrievesasessionID.
get_view Retrievesthepropertiesofasinglemanagedobject.
get_views Retrievesthepropertiesofasetofmanagedobjects.
load_session Usesasavedsessionfileforconnectingtoa
server.
login EstablishesasessionwiththeWebservicerunningonthevSpherehost.