in reply to Reading directly from a keyboard device, not simply <STDIN>
Here is something I played with for reading raw mouse. It locks up the X server, but may show a way.
#!/usr/bin/perl use strict; # WARNING: will probably lock up your X-server my $data; my $fd; my $buf; use POSIX; $fd = POSIX::open("/dev/mouse", &POSIX::O_RDONLY) || die ($!); while($data = POSIX::read($fd, $buf, 1)) { print "READ $data Bytes: " . join("", map(sprintf("%x",ord($_)), sp +lit(//, $buf))) . "\n"; }
|
|---|