AnyEvent-TermKey
view release on metacpan or search on metacpan
my $aetk = AnyEvent::TermKey->new(
term => \*STDIN,
on_key => sub {
my ( $key ) = @_;
print "Got key: ".$key->termkey->format_key( $key, FORMAT_VIM )."\n";
$cv->send if $key->type_is_unicode and
$key->utf8 eq "C" and
$key->modifiers & KEYMOD_CTRL;
},
);
$cv->recv;
DESCRIPTION
This class implements an asynchronous perl wrapper around the
"libtermkey" library, which provides an abstract way to read keypress
events in terminal-based programs. It yields structures that describe
examples/demo.pl view on Meta::CPAN
my $aetk = AnyEvent::TermKey->new(
term => \*STDIN,
on_key => sub {
my ( $key ) = @_;
print "Got key: ".$key->termkey->format_key( $key, FORMAT_VIM )."\n";
$cv->send if $key->type_is_unicode and
$key->utf8 eq "C" and
$key->modifiers & KEYMOD_CTRL;
},
);
$cv->recv;
lib/AnyEvent/TermKey.pm view on Meta::CPAN
my $aetk = AnyEvent::TermKey->new(
term => \*STDIN,
on_key => sub {
my ( $key ) = @_;
print "Got key: ".$key->termkey->format_key( $key, FORMAT_VIM )."\n";
$cv->send if $key->type_is_unicode and
$key->utf8 eq "C" and
$key->modifiers & KEYMOD_CTRL;
},
);
$cv->recv;
=head1 DESCRIPTION
This class implements an asynchronous perl wrapper around the C<libtermkey>
library, which provides an abstract way to read keypress events in
t/02on_key.t view on Meta::CPAN
undef $key;
$cv->recv;
is( $key->termkey, $aetk->termkey, '$key->termkey after h' );
ok( $key->type_is_unicode, '$key->type_is_unicode after h' );
is( $key->codepoint, ord("h"), '$key->codepoint after h' );
is( $key->modifiers, 0, '$key->modifiers after h' );
is( $key->utf8, "h", '$key->utf8 after h' );
is( $key->format( 0 ), "h", '$key->format after h' );
undef $aetk;
( run in 1.270 second using v1.01-cache-2.11-cpan-49f99fa48dc )