I am in the process of migrating some production code from Solaris, perl 5.8.0 to RHEL 5.5, perl 5.10. While testing our service we have stumbled upon a corruption when using Net::SSH::Perl and Net::Telnet. Here's my error:
Net-SSH-Perl failed with eval error:
Can't locate object method "blocking" via package "FileHandle" at /efs
+/dist/perl5/Net-SSH-Perl/1.30/
.exec/x86-64.rhel.5/5.10/lib/perl5/Net/SSH/Perl.pm line 216.
at ./ssh_bug_test_final.pl line 49.
Here's my code:
#!/usr/bin/env perl5.10.0
## your use lib as needed...
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Sortkeys++;
use Net::SSH::Perl;
use Net::Telnet; ## fails
## use Net::FTP; ## works
my ($server, $href, $conn, );
$server = 'some.test.server.com';
$href = {
'debug' => '1',
'options' => [ 'ChallengeResponseAuthentication no' ],
'protocol' => '2,1',
'use_pty' => '1'
};
warn "Running with perl version: %vd\n", $^V;
warn 'preparing to call Net::SSH::Perl. ', Dumper( $server, $href );
eval {
$conn = Net::SSH::Perl->new( $server, %$href );
};
if ($@) {
warn "Net-SSH-Perl failed with eval error: \n$@ ";
}
else {
print 'Net::SSH::Perl succeeds and returns: ', Dumper($conn);
}
The confusing thing is that I can use Net::FTP and not Net::Telnet, and my code passes. What is it in Net::Telnet that is corrupting the $sock object in Net::SSH::Perl?
Thanks for your wisdom!