为什么 Perl 的 Net::SFTP->new 抱怨“不是 ARRAY 引用”?
我正在尝试使用 Net::SFTP 连接到远程服务器。
我的脚本是:
my %args = (
ssh_args => {
user => 'canneu_scp',
identity_files => [ '/home/home1/cgrshah/responsys/capgemini.private' ],
debug => 1,
} );
my $targetserver='files.responsys.net';
my $sftp = Net::SFTP->new($targetserver, %args)
or die "could not open connection to $targetserver\n";
但是当我运行此脚本时,我收到一条错误消息:
Not an ARRAY reference at /usr/lib/perl5/site_perl/5.8.1/Net/SFTP.pm line 36.
任何人都可以帮助我吗?
I am trying to use Net::SFTP to get connected to remote server.
My script is:
my %args = (
ssh_args => {
user => 'canneu_scp',
identity_files => [ '/home/home1/cgrshah/responsys/capgemini.private' ],
debug => 1,
} );
my $targetserver='files.responsys.net';
my $sftp = Net::SFTP->new($targetserver, %args)
or die "could not open connection to $targetserver\n";
But when I run this, I get an error stating:
Not an ARRAY reference at /usr/lib/perl5/site_perl/5.8.1/Net/SFTP.pm line 36.
Can anyone help me with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这只是一个盲目的猜测,但是
user
选项不应该位于传递给ssh_args
的哈希中,它处于同一级别。尝试使用此代码:听起来上面的代码让您更进一步,但现在您遇到了问题,因为您的
Math::BigInt
太旧了。我看到了三种前进的方法:Math::BigInt
版本 1.78 或更高版本的 RPMMath::BigInt< 的副本/code>
第三个选项有很多陷阱,如果您决定使用它,我建议执行以下步骤:
App::cpanminus
wget -O- http://cpanmin.us | perl - --local-lib=~/perl5 App::cpanminus
~/perl5/bin
添加到您的路径Math::BigInt
安装到您的家中使用cpanm --local-lib=~/perl5 Math::BigInt
的目录use lib "$ENV{HOME}/perl5";
添加到脚本的开头,以便它可以找到新模块This is just a wild shot in the dark, but the
user
option should not be in the hash handed tossh_args
, it is at the same level. Try using this code instead:It sounds like the code above got you further along, and now you are having problems because your version of
Math::BigInt
is too old. I see three ways to move forward:Math::BigInt
version 1.78 or laterMath::BigInt
The third option has many pitfalls, and if you decide to go with it I would suggest the following steps:
App::cpanminus
wget -O- http://cpanmin.us | perl - --local-lib=~/perl5 App::cpanminus
~/perl5/bin
to your pathMath::BigInt
into your home directory withcpanm --local-lib=~/perl5 Math::BigInt
use lib "$ENV{HOME}/perl5";
to the start of your script so it can find the new modules