#!/usr/bin/perl use Term::ReadKey; use Time::HiRes qw(time); ReadMode 3; # 'noecho'; while (1) { my $key; my $wait_until = time + 3; while ( time < $wait_until ) { $key = ReadKey( -1 ); if ( defined $key ) { print STDERR "keystroke $key\t"; } } print "Something\n"; }
Be prepared to type in perl -e 'use Term::ReadKey; ReadMode 1;' blindly after executing the script to gt a working terminal again ;-)
Maybe some security feature (SELinux or AppArmor) gets in the way on your machine
In reply to Re: Problem with ReadKey
by jethro
in thread Problem with ReadKey
by jimhenry
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |