Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: IBM scan codes (pgup, pgdn, arrow keys)

by jlongino (Parson)
on Jun 15, 2002 at 04:13 UTC ( [id://174789]=note: print w/replies, xml ) Need Help??


in reply to IBM scan codes (pgup, pgdn, arrow keys)

I've never used Expect.pm before and it's not clear from your description, but I think this may be more complex than it appears.

I suppose that from the snippet you've posted that it is invoked on a 'nix system. If so, I guess that you're running it via a PC terminal session of some sort (telnet or Putty/other SSH type connection). If so, the program will expect keyboard codes that are agreed upon by both the 'nix system and the PC emulation software. The 'nix terminal type is probably the same as that defined for the account you're running it from. You'll need to lookup and use the escape sequences for that emulation and send them to Expect (hint: if you specify simple emulations, your control sequences can be simplified as well). You can try the methods explained by the other monks here, use the suggestions in Expect.pod:

Q: How do I send control characters to a process? A: You can send any characters to a process with the print command. To represent a control character in Perl, use \c followed by the lette +r. For example, control-G can be represented with "\cG" . Note that this will not work if you single-quote your string. So, to send control-C to a process in $exp, do: print $exp "\cC"; Or, if you prefer: $exp->send("\cC");
or build strings using the chr(dec) function:
$vt220_pgup = chr(27) . chr(91) . chr(51) . chr(126); print $exp $vt220_pgup
I could be totally off base on this, so please let me know if this is the case. I've made a lot of suppositions here but perhaps, if nothing else, it may give you a place to start.

--Jim

Log In?
Username:
Password:

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

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

    No recent polls found