我正在尝试运行一个 Perl 脚本,该脚本接受用户、传递、ip 参数并使用它通过 ssh 检查网络交换机的版本。但是,当我在我们的服务器上运行它时,我不断得到:
Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::FastCalc at /usr/lib/perl5/site_perl/5.10.0/Crypt/DH.pm line 6
它继续挂起一段时间,然后返回没有输出。是什么导致此失败,我该如何解决?我无权在服务器上安装额外的模块。
编辑:我检查了当前安装的模块,并且 Net::SSH:Perl、Math::BigInt::FastCalc 和 Math::Pari 都已安装,所以我不知道为什么加载这些模块时出现问题。
这是我的脚本供参考:
#!/usr/bin/perl
# Outputs the name of the Flash File (which denotes the software version) of the switch
#Input: User Pass Host
open(FH, ">>unparsed.txt");
open (FH2, ">>versions.txt");
use strict;
use Net::SSH::Perl;
my $user = $ARGV[0];
my $pass = $ARGV[1];
my $host = $ARGV[2]; #Hostname given as command line argument
my $cmd = "show version";
my $version;
print("\n");
print($ARGV[2]);
print("\n");
my $ssh = Net::SSH::Perl->new($host);
$ssh->login($user, $pass); # login to switch
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
printf FH ($stdout); #output all test to file
close(FH);
open(FH, "unparsed.txt");
while(<FH>){ #look through file for flash filename
if($_ =~ /System image file is "(.*)"/){
$version = $1;
}
}
print ($version); #output flash filename
print ("\n");
printf FH2 ($ARGV[2]);
printf FH2 ("\n");
printf FH2 ($version);
printf FH2 ("\n");
close(FH2);
close(FH);