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

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

Thread Previous | Thread Next
From:
ToddAndMargo
Date:
September 10, 2017 02:26
Subject:
Re: What is P6 for P5 `use Term::ReadKey`?
Message ID:
178f7aa4-00d8-612d-a380-bf7ec7efcd15@zoho.com
On 09/09/2017 02:02 PM, Timo Paulssen wrote:
> 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();
> 
> or
> 
> my $character = $*IN.getc();
> 
> or
> 
> my $character = $my-input-handle.getc();

Thank you!

> 
> 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 
> "/dev/tty".IO.open(:r);

You lost me

> 
> 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 
> https://linux.die.net/man/3/termios

Will look.  Thank you!

> Hope that helps!
>    - Timo


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About