ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
15.9. Checking for Waiting InputProblemYou want to know whether keyboard input is waiting without actually reading it. SolutionUse the CPAN module Term::ReadKey, and try to read a key in non-blocking mode by passing it an argument of use Term::ReadKey; ReadMode ('cbreak'); if (defined ($char = ReadKey(-1)) ) { # input was waiting and it was $char } else { # no input was waiting } ReadMode ('normal'); # restore normal tty settings DiscussionThe See AlsoThe documentation for the Term::ReadKey module from CPAN; Recipe 15.6 |