[Ssh-sftp-perl-users] Net::SSH::Perl and eval problem
Brought to you by:
dbrobins
|
From: nadim <na...@kh...> - 2004-10-21 05:48:33
|
Hi all,=20
I came across a problem today and I must say that I don't have the slightes=
t=20
clue of why things don't work as they should.
In the system I have, I need to let the user setup shells, I could let the=
=20
user give data to setup shells but I'd rather get some live objects as it i=
s=20
easier to not handle the diffrent types of shells I can use (local, SSH,=20
Telnet) and they might be other shell types only the user knows about. As=20
long as their shell implements the functions I need it can be whatever.
Creating SSH session is no problem and it has worked properly so far (that =
is=20
till last night). Creating SSH sessions through evaled text simply doesn't=
=20
work as it should. I narrowed down the problem to these lines. The code is =
=A0
for a minimal test to reproduce the problem not the original code.
<test.pl>
use Net::SSH::Perl ;
my $shell =3D Net::SSH::Perl->new('192.168.1.99', debug =3D> 1);
undef $shell ;
open(FILE, '<', "evaled.pl" ) or die ;
local $/ =3D undef ;
my $file_body =3D <FILE> ;
close(FILE) ;
my $distributor =3D eval $file_body ;
die $@ if $@ ;
</test.pl>
<evaled.pl>
use Net::SSH::Perl ;
my $shell =3D Net::SSH::Perl->new('192.168.1.99', debug =3D> 1);
</evales.pl>
The first SSH connection takes less than 0.2 seconds but the second one=20
(embedded in an eval) takes exactly 120 seconds!!!
khemir.net: Reading configuration data /home/nadim/.ssh/config
khemir.net: Reading configuration data /etc/ssh_config
khemir.net: Connecting to localhost, port 22.
khemir.net: Remote protocol version 1.99, remote software version=20
OpenSSH_3.6.1p2
khemir.net: Net::SSH::Perl Version 1.25, protocol version 1.5.
khemir.net: No compat match: OpenSSH_3.6.1p2.
khemir.net: Connection established.
khemir.net: Reading configuration data /home/nadim/.ssh/config
khemir.net: Reading configuration data /etc/ssh_config
khemir.net: Connecting to localhost, port 22.
khemir.net: Remote protocol version 1.99, remote software version=20
OpenSSH_3.6.1p2
khemir.net: Net::SSH::Perl Version 1.25, protocol version 1.5.
khemir.net: No compat match: OpenSSH_3.6.1p2.
khemir.net: Connection established.
real 120.30
user 0.07
sys 0.00
Any idea?
Cheers, Nadim.
|