6.5
Table Of Contents
- vSphere SDK for Perl Programming Guide
- Contents
- Getting Started with vSphere SDK for Perl
- Writing vSphere SDK for Perl Scripts
- Refining vSphere SDK for Perl Scripts
- Creating and Using Filters
- Filtering Views Selectively Using Properties
- Retrieving the ServiceInstance Object on a vSphere Host
- Saving and Using Sessions
- Using Multiple Sessions
- Learning About Object Structure Using Data::Dumper
- Specifying Untyped Arguments in Scheduled Tasks and Callbacks
- Using Advanced Subroutines
- vSphere SDK for Perl Subroutine Reference
- Web Services for Management Perl Library
- Credential Store Perl Library
vSphere SDK for Perl Programming Guide
42 VMware, Inc.
Subroutines in the Opts Package
TheOptspackageincludesthefollowingsubroutines:
“add_options”onpage 42
“get_option”onpage 42
“option_is_set”onpage 43
“parse”onpage 43
“validate”onpage 43
“usage”onpage 43
add_options
Addscustomoptionssothattheycanbesubmittedtoparsingandvalidation.Afterthescripthasvalidated
theoptions,thescriptcanusethematruntime.
Parameters
Returns
Returnsnothing.
get_option
Retrievesthevalueofthespecifiedbuilt‐inorcustomoption.
Parameters
Returns
Returnsoneofthefollowing,dependingupontheattributesdefinedfortheoption:
Returnvalueoffunc(afterexecution)ifafunctionisassociatedwiththeoption
Defaultvalue,ifoneisspecifiedfortheoption
logout DisconnectstheclientfromtheserverandclosestheconnectiontotheWebservice.
save_session Savesasessioncookie,whichisatextfile.
update_view_data Refreshesthepropertyvaluesofaviewobject.
Table 4-2. Subroutines in the Vim Package (Continued)
Subroutine Description
Table 4-3. Subroutines in the Util Package
Subroutine Description
connect Establishesasessionbyusingthetokenprovidedinapreviously‐savedsessionfile,orbyusingtheuser
nameandpasswordprovidedonthecommandline,inenvironmentvariables,orinaconfigurationfile.
disconnect Ifusedinconjunctionwithconnect(andasessionfile),doesnothing.Ifusedin
conjunctionwithauser
nameandpassword,logsoutandclosesthesession.
get_inventory_path Returnstheinventorypathforthespecifiedmanagedentity.
trace General‐purposeloggingfunctionusedinconjunctionwiththe--verbosecommand‐lineoption.
Parameter Description
%opts Nameofthehashvariablethatconsistsoftheoptionnameanditsattributes.
Parameter Description
option_name Stringvalueofthebuilt‐inorcustomoption.