我試圖運行一個Perl腳本,它接受用戶,傳遞,ip參數並使用它來檢查通過ssh的網絡交換機的版本。然而,當我在我們的服務器上運行它,我不斷收到:Perl 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中,數學:: BigInt有:: FastCalc,和數學::帕裏都安裝了,所以我不知道爲什麼它是有加載這些模塊的問題。
這裏是我的腳本供參考:
#!/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);