Subject: | Net::SCP::Expect seems to be broken under threads |
Hi,
Fist let me say this is a kickass module.
It seems that this module is broken when used under itreads. Here is a short example that demonstrates this problem.
-----------------------------------------------
#!/usr/bin/perl
use Net::SCP::Expect;
my $scpe = Net::SCP::Expect->new;
$scpe->login('user', 'pass');
$scpe->scp('/root/file','127.0.0.1:/root/file2');
exit;
----------------------------------------------------------
No output copies file correctly.
-----------------------------------------------------------
#!/usr/bin/perl
use threads;
use Net::SCP::Expect;
$thread = threads->new(\&scp);
$thread->join();
exit;
sub scp{
my $scpe = Net::SCP::Expect->new;
$scpe->login('user', 'pass');
$scpe->scp('/root/file','127.0.0.1:/root/file2');
return;
}
------------------------------------------------------------
outputs the following
thread failed to start: scp timed out while trying to connect to 127.0.0.1 at test.pl line 15
when the related scp commands are removed from the threaded version and some print statements are put in instead no problems with thread, "thread filaed to start" message dissapears.
This is using perl 5.8.1 with fedora core 1.
Ill test it under a more recent system and see if the problem still exists.
Adam Ruck