develooper Front page | perl.perl6.users | Postings from September 2017

Re: What is P6 for P5 `use Term::ReadKey`?

Thread Previous | Thread Next
Timo Paulssen
September 9, 2017 21:02
Re: What is P6 for P5 `use Term::ReadKey`?
Message ID:
The important part of the page is actually the one titled "Waiting for
potential combiners". You'll want to either use binary encoding instead
of utf8 (the default) or use an encoding that doesn't have combiners,
like latin1 or ascii.

> Problem: also from the link:
>     method getc(IO::Handle:D: --> Str:D)
>     multi sub getc (IO::Handle $fh = $*ARGFILES --> Str:D)

my $character = getc();


my $character = $*IN.getc();


my $character = $my-input-handle.getc();

Since you need to have an encoding that won't wait for combiners after a
key was pressed you'll probably have an open call, for example

You are already using termios to make the terminal "raw"; BTW, you only
need either makeraw or the 4 lines of flag setting and unsetting.

Also, the flags you were looking for are in the termios(3) man page. If
your system doesn't have it for some reason, have a look at

Hope that helps!
  - Timo

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About