0
這適用於按鍵,但不適用於鼠標點擊。我應該改變什麼才能使其工作(Term::TermKey)?Term :: TermKey:捕捉mouseevents和按鍵的正確方法是什麼?
#!/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), ">";
}
}
binmode STDOUT,':encoding(utf-8)'if if $ tk-> get_flags&FLAG_UTF8; 你可能的意思是'編碼(UTF-8)'這裏 – LeoNerd 2012-04-21 22:50:29
我認爲它們是等價的。 – 2012-04-22 06:00:49
首都'UTF-8'。 – LeoNerd 2012-04-22 22:48:13