5 @EXPORT = qw(cbreak cooked readkey);
8 use POSIX
qw(:termios_h);
9 my ($term, $oterm, $echo, $noecho, $fd_stdin);
11 $fd_stdin = fileno(STDIN
);
12 $term = POSIX
::Termios
->new();
13 $term->getattr($fd_stdin);
14 $oterm = $term->getlflag();
16 $echo = ECHO
| ECHOK
| ICANON
;
17 $noecho = $oterm & ~$echo;
20 $term->setlflag($noecho); # ok, so i don't want echo either
21 $term->setcc(VMIN
, 0);
22 $term->setcc(VTIME
, 1);
23 $term->setattr($fd_stdin, TCSANOW
);
27 $term->setlflag($oterm);
28 $term->setcc(VTIME
, 0);
29 $term->setattr($fd_stdin, TCSANOW
);
35 sysread(STDIN
, $key, 1);