Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Term::ReadKey under win32

by Dog and Pony (Priest)
on Apr 07, 2002 at 11:53 UTC ( [id://157262]=note: print w/replies, xml ) Need Help??


in reply to Term::ReadKey under win32

Sadly, I have no Windows box to try this on here. But you might want to try to set other ReadModes, such as "ultra-raw". Windows has some differences as to how it sends its enter command, and looking at the docs, it sounds like changing ReadMode might just do it. Just remember that Windows is actually sending two "numbers" (13 and 10) for every enter.

Like I said, couldn't test it. But it may be worth a try. :)

Update: Sorry that I forgot to mention this. Yes, your code works as expected on linux. It says "Key is 10" when I press enter, then moves on, just like it should.


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

Replies are listed 'Best First'.
Re: Re: Term::ReadKey under win32
by arc_of_descent (Hermit) on Apr 07, 2002 at 12:13 UTC
    Hi,
    Thanx for your suggestion, but it has already been explored by me.
    Further more, the Term::ReadKey docs says that
    under windows, the ultra-raw mode is the same as the raw mode.
    Since u mentioned that you don't have a windows box,
    I'd like to know whether that code works on linux terminals.

    Thanx

    --
    arc_of_descent

      You get a \n value ..Does this help ?
      #!/usr/bin/perl -w use strict; use Term::ReadKey; my $key; ReadMode 0; $key = ReadKey(0); print "Key is ", ord($key), "\n"; ReadMode 0; print "hit enter to exit...\n"; <>;

Log In?
Username:
Password:

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

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

    No recent polls found