【发布时间】:2020-05-04 01:41:54
【问题描述】:
那里
在网上::SSH2::简单,
将Windows7更新到Windows10后已不再ssh连接。
出现以下错误。
Net::SSH2::net_ss_timeout: invalid object Net::SSH2::Simple=SCALAR(0x3f5c218) at C:/Strawberry/perl/vendor/lib/Net/SSH2.pm line 111.
at C:/Strawberry/perl/vendor/lib/Net/SSH2.pm line 111.
Net::SSH2::connect(Net::SSH2::Simple=SCALAR(0x3f5c218), "xxxx.com", 22) called at C:/tool/eclipse_classic/workspace/test/work14.pl line 98
(in cleanup) Net::SSH2::net_ss_DESTROY: invalid object Net::SSH2::Simple=SCALAR(0x3f5c218) at C:/tool/eclipse_oxygen/eclipse/workspace/.metadata/.plugins/org.epic.debug/perl5db.pl line 4211.
我的代码是
use Net::SSH2::Simple;
$ssh2 = Net::SSH2::Simple->new();
$ssh2->connect( 'xxxx.com', 22 ) ;
$ssh2->auth_password( 'username', 'passwd' );
“$ssh2->connect”行出现错误。
但是
此代码使用 Net::SSH2 可以正常工作。
只有 Net::SSH2::Simple 不起作用。
到 xxxx.com 的连接很好。并没有发现用户名、密码错误。
我该如何解决这个问题。
Windows10 64位
草莓 Perl 5.30.1.1(64 位)
日食氧气
史诗 0.77
谢谢
【问题讨论】:
-
这可能是因为您让对象存活到全局销毁。如果将
$ssh2 = ...;替换为my $ssh2 = ...;,您会遇到问题吗? -
(你应该总是使用
use strict; use warnings;)
标签: perl perl-module strawberry-perl