Home > Archive > PERL Beginners > March 2004 > Using Perl Expect.pm
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using Perl Expect.pm
|
|
| Tapasranjanmohapatra 2004-03-26, 11:15 pm |
| Hi,
Can someone tell me how to handle the vt100 sequences using expect =
module of perl.
I have used the same sequences while using TCL Expect. It works fine. =
But I don't understand what is the problem while I try doing the same =
thing using Perl Expect.
If my TCL Expect Code goes like:-
=20
send "\x09" # hexadecimal equivalent of a tab
expect "\x1b?2;2H"
What should be the equivalent Perl code?
I am able to send "\x09" in perl but I think it doesn't expect the =
correct thing. Perhaps the semicolon has to be escaped but even after =
escaping the semicolon didn't solve the problem.
Can someone give some help or reference link where I can learn what =
these values
like "\x1b?2;2H" mean.
Thanks
| |
| Andrew Gaffney 2004-03-26, 11:15 pm |
| TapasranjanMohapatra wrote:
> Hi,
> Can someone tell me how to handle the vt100 sequences using expect module of perl.
> I have used the same sequences while using TCL Expect. It works fine. But I don't understand what is the problem while I try doing the same thing using Perl Expect.
> If my TCL Expect Code goes like:-
>
> send "\x09" # hexadecimal equivalent of a tab
> expect "\x1b?2;2H"
>
> What should be the equivalent Perl code?
> I am able to send "\x09" in perl but I think it doesn't expect the correct thing. Perhaps the semicolon has to be escaped but even after escaping the semicolon didn't solve the problem.
> Can someone give some help or reference link where I can learn what these values
> like "\x1b?2;2H" mean.
Most likely, the problem is that Perl is interpreting what is in the quotes first. Try
putting it in single quotes when you pass it to expect.
--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548
| |
| Bob Showalter 2004-03-26, 11:15 pm |
| TapasranjanMohapatra wrote:
> Hi,
> Can someone tell me how to handle the vt100 sequences using expect
> module of perl. I have used the same sequences while using TCL
> Expect. It works fine. But I don't understand what is the problem
> while I try doing the same thing using Perl Expect. If my TCL Expect
> Code goes like:-
>
> send "\x09" # hexadecimal equivalent of a tab
> expect "\x1b?2;2H"
>
> What should be the equivalent Perl code?
> I am able to send "\x09" in perl but I think it doesn't expect the
> correct thing. Perhaps the semicolon has to be escaped but even after
> escaping the semicolon didn't solve the problem. Can someone give
> some help or reference link where I can learn what these values
> like "\x1b?2;2H" mean.
Those sequences look OK to me.
$ perl -e 'print "\x09"' | od -ca
0000000 \t
ht
$ perl -e 'print "\x1b?2;2H"' | od -ca
0000000 033 ? 2 ; 2 H
esc ? 2 ; 2 H
Show us the Perl code you're using.
|
|
|
|
|