Re: [Ssh-sftp-perl-users] Net::SSH::Perl and eval problem
Brought to you by:
dbrobins
|
From: Good T. <aa...@rd...> - 2004-10-21 18:56:24
|
is it because of the 'local' and it's affect later on in the code?
aaron
--
Through correctness comes ease
-Chiun
On Thu, October 21, 2004 3:42 pm, nadim said:
> this :
> open(FILE, '<', "evaled.pl" ) or die ;
> local $/ = undef ;
> my $file_body = <FILE> ;
> close(FILE) ;
>
> should be this
> {
> open(FILE, '<', "evaled.pl" ) or die ;
> local $/ = undef ;
> my $file_body = <FILE> ;
> close(FILE) ;
> }
>
> On Thursday 21 October 2004 09:48, nadim wrote:
>> Hi all,
>>
>> I came across a problem today and I must say that I don't have the
>> slightest 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
>> user give data to setup shells but I'd rather get some live objects as
>> it
>> is easier to not handle the diffrent types of shells I can use (local,
>> SSH,
>> Telnet) and they might be other shell types only the user knows about.
>> As
>> 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 till last night). Creating SSH sessions through evaled text simply
>> doesn't work as it should. I narrowed down the problem to these lines.
>> The
>> code is for a minimal test to reproduce the problem not the original
>> code.
>>
>> <test.pl>
>> use Net::SSH::Perl ;
>>
>> my $shell = Net::SSH::Perl->new('192.168.1.99', debug => 1);
>> undef $shell ;
>>
>> open(FILE, '<', "evaled.pl" ) or die ;
>> local $/ = undef ;
>> my $file_body = <FILE> ;
>> close(FILE) ;
>>
>> my $distributor = eval $file_body ;
>> die $@ if $@ ;
>> </test.pl>
>>
>> <evaled.pl>
>> use Net::SSH::Perl ;
>> my $shell = Net::SSH::Perl->new('192.168.1.99', debug => 1);
>> </evales.pl>
>>
>> The first SSH connection takes less than 0.2 seconds but the second one
>> (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
>> 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
>> 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.
>>
>>
>> -------------------------------------------------------
>> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
>> Use IT products in your business? Tell us what you think of them. Give
>> us
>> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out
>> more
>> http://productguide.itmanagersjournal.com/guidepromo.tmpl
>> _______________________________________________
>> Ssh-sftp-perl-users mailing list
>> Ssh...@li...
>> https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out
> more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Ssh-sftp-perl-users mailing list
> Ssh...@li...
> https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users
>
|