Miker has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I have one that might not be possible...
What I'm doing is running a program with Open2, but need to send instructions to it when there is a single key-press. For that I'm using HotKey.pm from the Perl Cookbook.
The problem I run into is I need to wait on While which causes my other process to hang untill it gets that key. I want it to just run it and take the key-presses as they come so to speak. Here's a simplified version of what I mean:
Is there any way to check for a key-press that does not wait? Sort of check it on the fly, or periodicly? TIA, MikerUse HotKey.pm; foreach $i (@things) { &program_running($i); while ($keyboard = readkey) { # This is the gotcha if ($keyboard =~ /b/) { print "you pressed b \n"; } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: When is a while not a while?
by mikfire (Deacon) on Aug 24, 2000 at 19:15 UTC | |
by Miker (Scribe) on Aug 24, 2000 at 22:43 UTC | |
by Miker (Scribe) on Aug 25, 2000 at 00:13 UTC | |
RE: When is a while not a while?
by jreades (Friar) on Aug 24, 2000 at 19:06 UTC | |
by tilly (Archbishop) on Aug 24, 2000 at 19:25 UTC | |
by jreades (Friar) on Aug 25, 2000 at 16:47 UTC | |
by merlyn (Sage) on Aug 25, 2000 at 17:39 UTC | |
by tilly (Archbishop) on Aug 25, 2000 at 17:49 UTC | |
by jreades (Friar) on Aug 25, 2000 at 22:03 UTC | |
| |
by Miker (Scribe) on Aug 24, 2000 at 19:11 UTC |
Back to
Seekers of Perl Wisdom