in reply to Re: How do I read just one key at a time?
in thread How do I read just one key at a time?
or something similar will work. The flags and function calls used by the POSIX::Termios module are nearly identical to the corresponding ones in C.use POSIX qw(:termios_h); my $termios = new POSIX::Termios; $termios->setlflag(~ICANON); # Turn off canonical mode $termios->setcc(VMIN, 1); # Read a min of 1 character $termios->setcc(VTIME, 0); # No time-out on reads $termios->setattr(0, TCSANOW); # Apply settings to STDIN while(read(STDIN, $key, 1)) { print "Got: $key\r\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: RE: Re: How do I read just one key at a time?
by Anonymous Monk on Nov 20, 2003 at 19:13 UTC | |
by Anonymous Monk on Nov 20, 2003 at 19:16 UTC |