I'm writing a program where a process runs in a loop. I want to process keyboard input without disturbing the main process in the loop. I'm trying to use the Win32::Console module for this task (see code below), but the module blocks on the Input statement. Is there some way to make this non-blocking, or maybe even use a different technique entirely that does not block? I tried whipping an IOCTL statement on it, but I either did it wrong, or it does not work. use strict; use warnings; use Win32::Console;
my $STDIN = new Win32::Console(STD_INPUT_HANDLE); $STDIN->Mode(ENABLE_PROCESSED_INPUT); # Un-buffer STDOUT. select((select(STDOUT), $| = 1)[0]); while (1) { my @input = $STDIN->Input(); if (defined $input[0] and $input[0] == 1) { if ($input[1]) { last if $input[5] == 27; # ESC key. if ($input[5] == 8) {print "\x08", ' ', "\x08"; next;} # Backspace key. print chr($input[5]); } } } As an aside, I think we need to get more traffic on this list somehow. Barry Brevik _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs