My problem:
I would like to have a module that can check to see if the user is pressing keys at any time, and what keys are being pressed. I don't want to have to wait for a carriage return.
My failed solution:
#!/usr/local/bin/perl5 # Use Perl 5 use Term::ReadKey; my $c = ""; ReadMode(5); while ($c ne "q") # Press q to exit { $c = ReadKey(-1); if ($c ne "") { print $c; } } ReadMode(0);
Why it Fails:
Although it returns characters, numbers, and symbols just fine, it returns something strange on other keyboard input, such as the delete key, arrow keys, insert, home, etc. In the terminal it looks like a space, but it is something else. I know this because when I test for " ", it doesn't equate.
Question:
How can I get the keystrokes I'm looking for?
-----------------------------------
Washizu
The best offense is a good offense.
In reply to Reading all nonblocking keystrokes in Win2000 by Washizu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |