Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Corruption between Net::SSH::Perl and Net::Telnet

by smile4me (Beadle)
on Sep 19, 2012 at 15:53 UTC ( [id://994476]=perlquestion: print w/replies, xml ) Need Help??

smile4me has asked for the wisdom of the Perl Monks concerning the following question:

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!

Replies are listed 'Best First'.
Re: Corruption between Net::SSH::Perl and Net::Telnet
by Illuminatus (Curate) on Sep 19, 2012 at 18:40 UTC
    From the cpan POD info on Net::Telnet:
    If you have the IO:: libraries installed (they come standard with perl5.004 and later) then IO::Socket::INET is used as a base class, otherwise FileHandle is used.
    Net::Ftp only uses the IO libraries. It seems like the IO libraries are there (or Net::Ftp would complain), but that's where I'd begin looking. Try explicitly using IO::Socket::INET at the top.

    fnord

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://994476]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-24 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found