#!/usr/bin/perl use strict; use Net::OpenSSH; use Net::SSH::Perl; my $host = $ARGV[0] // "localhost"; for my $len (10, 100, 1000, 2000, 4000, 6000, 8000, 10000, 20000, 50000) { my $cmd = "echo "; $cmd .= "." x $len; warn "trying with Net::OpenSSH, len=$len...\n"; my $ssh1 = Net::OpenSSH->new($host); my ($stdout1, $stderr1) = $ssh1->capture($cmd) or die "Failed!\n"; warn "Failed $?!\n" if $?; warn "trying with Net::SSH::Perl, len=$len...\n"; my $ssh2 = Net::SSH::Perl->new( $host, # debug => 1, options => [ "BatchMode yes", "PasswordAuthentication no", "ConnectTimeout 15" ] ); $ssh2->login("root") or die "Failed to login: $!\n"; warn "logged\n"; my ($stdout2, $stderr2, $exit) = $ssh2->cmd($cmd); warn "Failed $exit!\n" if $exit; }