Net::telnet and R arrow
am 27.02.2006 17:02:49 von pauld
Im retrieving information from our telnet server , which it displays a
page at a time . The on -screen prompt is "press L or R arrow for
more"
http://www.cl.cam.ac.uk/~mgk25/ucs/wgl4.txt says R arrow is 2192
http://perldoc.perl.org/perlreref.html
do {$text=$t->get;
#print "$text";
$names.=$text;}
until ($text=~m/duplicates/);
(duplicates is the last ASCII that appears on the screen )
and ive tried
$t->put(\x{2192}); (or print(\x{2192})
which gives an error
"Can't call method "x" without a package or object reference"
How can i send a R or L arrow ?
OS=gentoolinux
perl 5.8.6-r6
Re: Net::telnet and R arrow
am 27.02.2006 21:25:59 von Kalle Olavi Niemitalo
"pdc124" writes:
> $t->put(\x{2192}); (or print(\x{2192})
>
> which gives an error
> "Can't call method "x" without a package or object reference"
The \x syntax for hexadecimal character codes works only in
quoted strings. So you could have print("\x{2192}").
However, U+2192 is a printable character and not easy to type on
common keyboard layouts. It is therefore likely that your telnet
server is not expecting that character but rather an escape
sequence like "\e[C" or "\e[D". See Standard ECMA-48.
I don't know if you need to negotiate some Telnet options before
sending these.
Re: Net::telnet and R arrow
am 28.02.2006 08:58:22 von pauld
thanks ive read all 108 pages of
Standard ECMA-48 (Fifth Edition - June 1991 Reprinted June 1998)
Control Functions for Coded Character Sets from
http://www.ecma-international.org/publications/standards/Ecm a-048.htm
and cant find a reference to right and left arrows .
Am I looking in the wrong place ?
Re: Net::telnet and R arrow
am 28.02.2006 13:18:29 von pauld
update :
http://www.linux.cz/lists/archive/linux/82763.html seems to indicate
that the sequence you posted is what i I should be sending to the
server
$t->put(e\[D);
is
Unquoted string "e" may clash with future reserved word at
/usr/local/bin/telnet.pl line 54.Backslash found where operator
expected at /usr/local/bin/telnet.pl line 54, near "e\"
$t->put("e\[D");
Use of uninitialized value in regexp compilation
$t->put("\e\[D"); (trying to escape it )
Use of uninitialized value in regexp compilation at
/usr/local/bin/telnet.pl line 55.
sorry to be soe dumb .
Re: Net::telnet and R arrow
am 28.02.2006 14:56:28 von Jake Peavy
pdc124 wrote:
> $t->put("e\[D");
1) ITYM "\e[D"
> Use of uninitialized value in regexp compilation
2) I suspect this warning is being thrown by some other portion of your
code. the line above would not trigger such a warning.
3) to send a "right" I would do the following:
use charnames qw{ :full };
# and later...
$t->put(\N{RIGHTWARDS ARROW});
-jp
Re: Net::telnet and R arrow
am 28.02.2006 15:00:17 von Jake Peavy
DJ Stunks wrote:
> pdc124 wrote:
> > $t->put("e\[D");
>
> 1) ITYM "\e[D"
>
> > Use of uninitialized value in regexp compilation
>
> 2) I suspect this warning is being thrown by some other portion of your
> code. the line above would not trigger such a warning.
>
> 3) to send a "right" I would do the following:
>
> use charnames qw{ :full };
>
> # and later...
> $t->put(\N{RIGHTWARDS ARROW});
oops.
make that: $t->put("\N{RIGHTWARDS ARROW}");
muh bad.
-jp
Re: Net::telnet and R arrow
am 28.02.2006 15:18:40 von pauld
"I suspect this warning is being thrown by some other portion of your
code. the line above would not trigger such a warning. ". Correct -
sorry to be so hopeless at this.
with this in
$t->put("\N{RIGHTWARDS ARROW}");
i get this error message
Wide character in print at /usr/lib/perl5/5.8.6/i686-linux/IO/Handle.pm
line 399.
Wide character in syswrite at
/usr/lib/perl5/site_perl/5.8.6/Net/Telnet.pm line 3010.
Re: Net::telnet and R arrow
am 28.02.2006 17:50:19 von Jake Peavy
pdc124 wrote:
> "I suspect this warning is being thrown by some other portion of your
> code. the line above would not trigger such a warning. ". Correct -
> sorry to be so hopeless at this.
>
>
> with this in
>
> $t->put("\N{RIGHTWARDS ARROW}");
> i get this error message
>
> Wide character in print at /usr/lib/perl5/5.8.6/i686-linux/IO/Handle.pm
> line 399.
> Wide character in syswrite at
> /usr/lib/perl5/site_perl/5.8.6/Net/Telnet.pm line 3010.
well, those are only warnings, did it actually work?
if not, (re-reading this thread -- which I should have done before
posting at all), Kalle may be right and you may be back to trying to
send your "\e[D" virtualkey.
-jp
Re: Net::telnet and R arrow
am 28.02.2006 22:01:54 von Kalle Olavi Niemitalo
"pdc124" writes:
> thanks ive read all 108 pages of
> Standard ECMA-48 (Fifth Edition - June 1991 Reprinted June 1998)
> Control Functions for Coded Character Sets from
> http://www.ecma-international.org/publications/standards/Ecm a-048.htm
>
> and cant find a reference to right and left arrows .
They are in clauses 8.3.20 (CUF - CURSOR RIGHT) and 8.3.18 (CUB -
CURSOR LEFT).
ECMA-48 is mostly phrased in terms of what a terminal should do
when it _receives_ control sequences, for example from a Telnet
server. However, terminals can also _send_ these sequences when
the user presses keys. Clauses 8.3.52 (FNK - FUNCTION KEY) and
8.3.68 (INT - INTERRUPT) make this particularly clear.
Re: Net::telnet and R arrow
am 01.03.2006 09:28:19 von pauld
doesnt retrieve the next 'page' of information
ie
###SEND r ARROW
$matchtext='duplicates';
#$t->put("\e\[D");
$t->put("\N{RIGHTWARDS ARROW}"); #same for $t->print
do {$text=$t->get;
print "$text";
$names.=$text;}
until ($text=~m/$matchtext/);
produces
Wide character in print at /usr/lib/perl5/5.8.6/i686-linux/IO/Handle.pm
line 399.
Wide character in syswrite at
/usr/lib/perl5/site_perl/5.8.6/Net/Telnet.pm line 3010.
as output
/tmp/inputlog contains the first 'page' of the stuff im trying to
retrieve
so how do I send the virtual key ?
Re: Net::telnet and R arrow
am 01.03.2006 16:29:06 von Steve van der Burg
"pdc124" wrote in
news:1141201698.979775.83190@u72g2000cwu.googlegroups.com:
> doesnt retrieve the next 'page' of information
> ie
> ###SEND r ARROW
> $matchtext='duplicates';
> #$t->put("\e\[D");
> $t->put("\N{RIGHTWARDS ARROW}"); #same for $t->print
> do {$text=$t->get;
> print "$text";
> $names.=$text;}
> until ($text=~m/$matchtext/);
>
> produces
> Wide character in print at /usr/lib/perl5/5.8.6/i686-
linux/IO/Handle.pm
> line 399.
> Wide character in syswrite at
> /usr/lib/perl5/site_perl/5.8.6/Net/Telnet.pm line 3010.
> as output
>
> /tmp/inputlog contains the first 'page' of the stuff im trying to
> retrieve
>
> so how do I send the virtual key ?
You may be sending the key to the host, but then your end isn't
responding the same way a terminal would to the application on the host
end after that, so no second page. I found this out when writing an
application that did user emulation. Looking at packet traces of a
real user connected via telnet and using a VT-100 terminal emulator
showed that the terminal side had to respond to some sequences that the
host side was sending.
That led me to use this:
http://search.cpan.org/~ajwood/Term-VT102-0.82/
in conjunction with Net::Telnet to get the job done.
....Steve
--
Steve van der Burg
Technical Analyst, Information Services
London Health Sciences Centre
London, Ontario, Canada
Email: steve.vanderburg@lhsc.on.ca