Help language development. Donate to The Perl Foundation
Term::ReadKey
Read single (unbuffered) keys from terminal.
use Term::ReadKey;
react {
whenever key-pressed(:!echo) {
given .fc {
when 'q' { done }
default { .uniname.say }
}
}
}
Reads one unbuffered (unicode) character from STDIN and returns it as Str or Nil if nothing could be read. By default the typed character will be echoed to the terminal unless :!echo
is passed as argument.
Returns a supply that emits characters as soon as they're typed (see example in SYNOPSIS). The named argument :$echo
can be used to enable/disable echoing of the character (on by default).
Jonas Kramer [email protected]
Copyright 2018 Jonas Kramer.
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.