未编译的.pl像烫伤的狗一样运行。编译版本抛出:
Can't locate object method "simple_request" via package "RPC::XML::Client::new: Unable to get RPC::XML::Parser object" (perhaps you forgot to load "RPC::XML::Client::new: Unable to get RPC::XML::Parser object"?)
代码:
#/usr/bin/perl
use strict;
use RPC::XML;
use RPC::XML::Client;
$VNEURL = "https://" . "$ConfIPHost" . "/api/";
$VNESession = RPC::XML::Client->new("$VNEURL", useragent => [ ssl_opts => {
verify_hostname => 0,
SSL_verify_mode => "SSL_VERIFY_NONE"
} ] );
$VNEAuthCookie = $VNESession->simple_request('login', 2, 0, $ConfIPUser, $ConfIPPass) or die("Failed to log in to IP360.");
答案 0 :(得分:1)
在文档中,作者似乎这样做:
require RPC::XML;
require RPC::XML::Client;
而不是'使用'。这可以解释为什么它在编译时不会为你运行,因为在编译时会使用它。