vsphere perl sdk 5.5版安装在centos 7 64位机器上
以下 simpleclient.pl(https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.perlsdk.pg.doc/viperl_modscripts.4.2.html#990705)脚本抛出错误“length() used在 /usr/lib64/perl5/IO/Compress/Zlib/Extra.pm 第 198 行的 @array 上(您的意思是“标量(@array)”吗?)。在 centos-7 64 位机器上。
root@localhost vsphere_perl_exp]# cat simpleclient.pl
#!/usr/bin/perl
use strict;
use warnings;
use VMware::VIRuntime;
my %opts = (
entity => {
type => "=s",
variable => "VI_ENTITY",
help => "ManagedEntity type: HostSystem, etc",
required => 1
},
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate();
Util::connect();
# Obtain 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);
[root@localhost vsphere_perl_exp]# perl --version
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 25 registered patches, see perl -V for more detail)
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
使用调试选项运行 perl 在第 11 行停止,
[root@localhost vsphere_perl_exp]# perl -d ./simpleclient.pl --server 15.218.113.152 --username root --password 'secret' --entity HostSystem
Loading DB routines from perl5db.pl version 1.37
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(./simpleclient.pl:6): my %opts = (
main::(./simpleclient.pl:7): entity => {
main::(./simpleclient.pl:8): type => "=s",
main::(./simpleclient.pl:9): variable => "VI_ENTITY",
main::(./simpleclient.pl:10): help => "ManagedEntity type: HostSystem, etc",
main::(./simpleclient.pl:11): required => 1
DB<1> main::(./simpleclient.pl:14): Opts::add_options(%opts);
DB<1>
我是 perl 的新手,如何调试这个脚本?