我可以通过putty从我的计算机连接到服务器,但是当我使用以下代码时,它会超时:
use warnings;
use strict;
use Net::SSH2;
my $host = ""; # this will be some host ip address
my $ssh2 = Net::SSH2->new();
my $version = $ssh2->version();
print "Version = $version\n";
print "$_\n" for @Net::SSH2::ISA;
$ssh2->connect( $host ) or die "Unable to connect to host $@ \n";
print "Something1\n";
my $stuff = $ssh2->exec( "some command" );
print "Something2\n";
print $stuff;
$ssh2->disconnect();
每当我打电话给这个时,我最终会输出:
Version = 1.2.5
Exporter
Usage: Net::SSH2::timeout(ss, timeout) at C:/Strawberry/perl/site/lib/Net/SSH2.pm line 111.
另外,
perl -MNet::SSH2 -le"print $Net::SSH2::VERSION"
0.62
有人可以告诉我我做错了吗?