这适用于按键,但不适用于鼠标点击。我应该在此处更改什么以使其正常工作(Term::TermKey)?
#!/usr/bin/env perl
use warnings;
use 5.12.0;
use utf8;
use Term::TermKey qw(FLAG_UTF8);
my $tk = Term::TermKey->new( \*STDIN );
binmode STDOUT, ':encoding(utf-8)' if $tk->get_flags & FLAG_UTF8;
while( 1 ) {
my $key;
$tk->waitkey( $key );
if ( $key->type_is_mouse ) {
my ( $ev, $button, $line, $col ) = $tk->interpret_mouse( $key );
say "event : $ev";
say "button: $button";
say "line : $line";
say "col : $col";
}
else {
say "<", $tk->format_key( $key, 0 ), ">";
}
}