POE::W...Curses(3pm)
β¨ NAME β¨
okay bestie, welcome to the POE::W...Curses(3pm) page. This is all about POE::Wheel::Curses β non-blocking input for Curses. π
π SYNOPSIS β¨
Here's the whole vibe, bestie β copy/paste this and you're cooking:
use Curses;
use POE qw(Wheel::Curses);
POE::Session->create(
inline_states => {
_start => sub {
$_[HEAP]{console} = POE::Wheel::Curses->new(
InputEvent => 'got_keystroke',
);
},
got_keystroke => sub {
my $keystroke = $_[ARG0];
# Make control and extended keystrokes printable.
if ($keystroke lt ' ') {
$keystroke = '<' . uc(unctrl($keystroke)) . '>';
}
elsif ($keystroke =~ /^\d{2,}$/) {
$keystroke = '<' . uc(keyname($keystroke)) . '>';
}
# Just display it.
addstr($keystroke);
noutrefresh();
doupdate;
# Gotta exit somehow.
delete $_[HEAP]{console} if $keystroke eq "<^C>";
},
}
);
POE::Kernel->run();
exit;
π DESCRIPTION π¦
POE::Wheel::Curses implements non-blocking input for Curses programs. No cap.
POE::Wheel::Curses will emit an "InputEvent" of your choosing whenever an input event is registered on a recognized input device (keyboard and sometimes mouse, depending on the curses library). Meanwhile, applications can be doing other things like monitoring network connections or child processes, or managing timers and stuff.
π PUBLIC METHODS π
POE::Wheel::Curses is rather simple.
β¨ new πΈ
new() creates a new POE::Wheel::Curses object. During construction, the wheel registers an input watcher for STDIN (via select_read()) and registers an internal handler to preprocess keystrokes.
new() accepts only one parameter "InputEvent". "InputEvent" contains the name of the event that the wheel will emit whenever there is input on the console or terminal. As with all wheels, the event will be sent to the session that was active when the wheel was constructed.
π¨ bestie, important: an application may only have one active POE::Wheel::Curses object. Periodt.
π EVENTS AND PARAMETERS π
These are the events sent by POE::Wheel::Curses.
π InputEvent π
"InputEvent" defines the event that will be emitted when POE::Wheel::Curses detects and reads console input. This event includes two parameters:
$_[ARG0]β contains the raw keystroke as received byCurses::getch(). An application may process the keystroke usingCurses::unctrl()andCurses::keyname()on the keystroke.$_[ARG1]β contains thePOE::Wheel::Cursesobject's ID.
Mouse events aren't portable. As of October 2009, it's up to the application to decide whether to call mousemask().
π SEE ALSO β
Curses documents what can be done with Curses. Also see the man page for whichever version of libcurses happens to be installed (curses, ncurses, etc.).
POE::Wheel describes wheels in general.
The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.
π BUGS π
None known, although curses implementations vary widely.
π«Ά AUTHORS & COPYRIGHTS π
Please see POE for more information about authors and contributors.
okay bestie, that's the whole page. This was POE::W...Curses(3pm), from perl v5.34.0, dated 2022-03-25. slay. π
β¨
π¦ where this page comes from
- debian bookworm: libpoe-perl 2:1.3700-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libpoe-perl 2:1.3700-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpoe-perl 2:1.3700-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libpoe-perl 2:1.3700-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms