【问题标题】:Net::SSH2::Simple failed after update to Windows10Net::SSH2::Simple 更新到 Windows10 后失败
【发布时间】: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


【解决方案1】:

Net::SSH2::Simple 0.01 于 2009 年 12 月 13 日发布。当时 Net::SSH2 为 0.28 (2009-10-24),现在为 0.70 (2019-3-17)。

通过使用 Net::SSH2 安装较早版本 0.58 (2015-12-20),我得到了 Net::SSH2::Simple 在 Windows10 64bit / Strawberry Perl 5.30.0.1 (64bit) 上工作

cpan install SALVA/Net-SSH2-0.58.tar.gz

版本 0.59_20 (2016-05-11) 给出了“net_ss_timeout: invalid object”错误。 0.59_01 版的change log 有这个警告

      ** WARNING: this release includes lots of changes, some
      visible, most internal. Regressions are expected. Also,
      it introduces some minor backward incompatible changes -
      but in those cases, the old behavior was broken or insane
      anyway.

【讨论】:

  • 我建议您不要将 0.28 版的 Net::SSH2 用于任何严重的事情。如果充满了错误并且完全不可靠。
猜你喜欢
  • 2019-02-15
  • 1970-01-01
  • 2014-08-20
  • 1970-01-01
  • 2020-08-21
  • 1970-01-01
  • 2018-09-06
  • 1970-01-01
  • 2018-04-19
相关资源
最近更新 更多