perlquestion
pattyj
I've asked this on their mailing list, but it's not very active, so posting here...
My Net::SSH::Perl-using script hangs for at least five minutes (maybe forever?) when the number of characters in the command is large.
<code>
#!/usr/bin/perl
use strict;
use Net::SSH::Perl;
my $host = "blah";
my $ssh = Net::SSH::Perl->new(
$host,
debug => 1,
options => [
"BatchMode yes",
"PasswordAuthentication no",
"ConnectTimeout 15",
]
);
$ssh->login("root")
or die "Failed to login: $!\n";
my $cmd = "echo ";
$cmd = "."x50000;
my ($stdout, $stderr, $exit) = $ssh->cmd($cmd);
die "Failed!\n"
unless ($exit == 0);
print "$stdout\n";
</code>
Chang 50000 to 20000 and it will work. Same problem on all hosts I tested against.
Can anyone help me understand why?