How to pass a control-6 in Net::Telnet

P

pablo.barbachano

Hi, I'm just developing a small script that communicates with a small
piece of hw. The hw switches between modes when you press Control-6.
How can I send that from Net::Telnet? I suppose that the ->put($value)
is the most suitable since it doesn't add a "\n" at the end, but what
is the $value I have to put there? AFAIK control-6 is not one of the
ASCII escape sequences, is it?

Thanks in advance
Pablo
 
T

Ted Zlatanov

Hi, I'm just developing a small script that communicates with a small
piece of hw. The hw switches between modes when you press Control-6.
How can I send that from Net::Telnet? I suppose that the ->put($value)
is the most suitable since it doesn't add a "\n" at the end, but what
is the $value I have to put there? AFAIK control-6 is not one of the
ASCII escape sequences, is it?

(usually you can use Control-V to input a character in the shell, as I
did below)

perl -ne 'chomp; foreach $c (split //, $_) { printf "char code %d\n", ord $c;}'
h
char code 104
hello
char code 104
char code 101
char code 108
char code 108
char code 111
^^ <- I pressed Control-V Control-6 here
char code 30

Note that Control-6 is actually Control-^ probably. There are strange
interactions between input layers in Unix sometimes, and Control
combinations are an example. When X listens to keyboard events, it
will see Control and 6, while a terminal process will see Control-^
only (terminals only have ASCII controls available, basically, and
those only cover a few of the possible Control-KEY combinations, and
always assume uppercase when KEY is a letter). So you can enter
Control-^ in Emacs, for example, with

Control-q Control-Shift-6

and then move to the "^^" character and press C-x = to see its decimal
and hex code. I'm mentioning this in case you want to type this
character directly into a file while using a X editor such as Emacs.
Control-6 won't do it.

Hope this helps somewhat...
Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,038
Members
47,633
Latest member
BriannaLyk

Latest Threads

Top