[NTLUG:Discuss] (back to telnet) expect vs perl (was Telnet question)

JM5379@sbcglobal.net JM5379 at sbcglobal.net
Fri Aug 2 09:41:00 CDT 2002


I'm also familiar with perl and may consider it later on, but the
real question right now is telnet itself, since the problems I'm
having are specific to it rather than the programming language;
the problems occur whether I login manually or use a script.

The original problem was interpreting <cr><lf>.  I figured out
the fix for that but now a new problem... accepting and properly
interpreting function keys (F1 - F4 for this particular server).
 What currently happens is when I press F1 or F2 or ... the
system appears to "lock", but is actually waiting for additional
input; when I enter 10 additional keys, that allows the 11th
keypress to be processed correctly.

Has anyone seen behavior like this and know what is causing it
and how to eliminate it?

Thanks in advance,
Joe


--- Original Message ---
From: rob apodaca <robert.apodaca at attbi.com>
To: discuss at ntlug.org
CC: jm5379 at sbcglobal.net
Subject: Re: [NTLUG:Discuss] expect vs perl (was Telnet question)

>On 01 Aug 2002 18:43:31 -0500
>jm <jm5379 at sbcglobal.net> wrote:
>
>> I'm trying to write an Expect script (my first, as I read
Exploring
>> Expect) to login to a server; I'm currently having a problem
when I
>> actually send login data to the server, either via Expect or
>> interactively...
>> 
>> My .telnetrc has the following options defined for this
specific system
>> connection:
>> 
>> system.name.com
>> 	unset echo
>> 	mode character
>> 
>> When i type in my userid and hit <enter>, the cursor goes down
to the
>> next line, echos the userid again and simply waits; pressing
<enter>
>> drops the cursor down by 2 lines each time.
>> 
>> However...
>> 
>> If I enter ^] to get back to the telnet prompt, simply hit <enter>
>> enough times to get back into the server, <enter> begins
working exactly
>> as it should.
>> 
>> What is the ^] sequence changing in the <enter> functionality
(and why),
>> or what option(s) do I need to add to .telnetrc to modify <enter>s
>> default behavior?  Or as a last resort, how can I pass Control
>> characters via Expect so they are recognizable by the
receiving system
>> rather than just being displayed on the screen as ^E or whatever?
>> 
>> Other users w/Hummingbird's telnet work fine so it should be
just a
>> simple setting.  The goal is to automate downloading configuration
>> files, but the receiving systems apparently have severe time
>> sensitivities so copy/paste blows up all too often to be feasible.
>> 
>> Any help over what should be a minor bump will be greatly
appreciated.
>> Joe
>
>I'm not sure I can offer any help but, I am curious...what are
the advantages to using Expect vs using Perl?
>
>It appears that one could write a script very quickly...even
automatically using autoexpect. However, from the man pages,
there could be timing issues when using programs like telnet,
ftp, ssh, etc because these types of programs might ignore
keystrokes if they come before the prompt. So now one might have
to insert a sleep into the Expect script. The timing could vary
depending on server or network load. This all seems a little too
'loose' to me. It reminds me of my MS windows days using
'ezmacro'. Of course, I am not an authority on Expect because
I've only looked at it and tried it a few times - I may be
ignorant of some of its features.
>
>Perl, on the other hand, or I should say Perl's modules, have
taken care of the whole login interactive thing with services
like telnet, ftp, ssh, etc. I guess the downside is that the
learning curve for Perl is a bit steep. Also, to use these
services, one needs the appropriate Perl Modules. If a user does
not have root privileges to install the modules, then Expect may
be the only option available.
>
>I certainly don't want to start a war here. I am obviously
biased towards Perl because that's what I know and use. I am just
curious to know what others think about the subject.
>
>Cheers,
>rob
>
>_______________________________________________
>http://www.ntlug.org/mailman/listinfo/discuss






More information about the Discuss mailing list