我想脚本在Linux中和ESXi主机之间的相互作用,使用VMware Perl库(这似乎在调用SOAP服务ESXi主机)。未定义的子程序LWP ::协议:: HTTPS ::插座:: can_read称为
我收到了,我无法找到一个解决方案的错误:Undefined subroutine &LWP::Protocol::https::Socket::can_read called at /usr/local/share/perl5/LWP/Protocol/http.pm line 22
我目前正在运行的Net-HTTP-6.03。我曾尝试与网络-HTTP-6.05,但它使基于网络的调用非常慢(以及随后的人也最终失败,而不是用XML作为错误消息的约1.2MB) - 其中各个论坛的建议是只通过恢复解析到6.03(通过cpan install GAAS/Net-HTTP-6.03.tar.gz
)。
我的代码的关键如下:
use VMware::VIRuntime;
my $context = {
options => ParseOptions(), # result of using GetOpts::Long to parse command-line
session => undef
};
$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL"; # Suppresses SSL_VERIFY_NONE
if ($context->{options}->{'ignore-ssl-errors'}) {
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; # Ignores certificate errors
}
## next line fails
$context->{session} = Vim::login(
service_url => $context->{options}->{url},
username => $context->{options}->{username},
password => $context->{options}->{password}
);
有没有别的东西,我(能|需要)做的就是这个工作?