使用带有线程的Net :: ssh :: perl模块时出现分段错误

时间:2014-12-17 08:41:15

标签: multithreading perl ssh

运行此程序后

Segmentation fault (core dumped)

以下代码:

use threads;
use Net::SSH::Perl;

my $host = 'hostname';
my $user = 'root';
my $password = 'root123';

my $thread = threads->new (\&ThreadEntry,"ls");
my $thread1 = threads->new (\&ThreadEntry,"ls -al ");

sub ThreadEntry()
{
    my $ssh = Net::SSH::Perl->new($host, 35903);
    print "in ssh function \n";
    my($stdout, $stderr, $exit) =$ssh->cmd(@_);
    print "$stdout $stderr $exit\n";
}

$thread->join();
$thread1->join();

1 个答案:

答案 0 :(得分:1)

这是一个已知的错误,请参阅以下链接:
https://rt.cpan.org/Public/Bug/Display.html?id=62053