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

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

Thread Previous
From:
ToddAndMargo
Date:
September 9, 2017 19:49
Subject:
Re: What is P6 for P5 `use Term::ReadKey`?
Message ID:
8e74e291-8c35-13ad-43f6-a6d1da1abac2@zoho.com
On 09/09/2017 11:28 AM, Brandon Allbery wrote:
> On Sat, Sep 9, 2017 at 2:57 AM, ToddAndMargo <ToddAndMargo@zoho.com 
> <mailto:ToddAndMargo@zoho.com>> wrote:
> 
>     This guy maybe?
> 
>     https://github.com/krunen/term-termios/blob/master/README.md
>     <https://github.com/krunen/term-termios/blob/master/README.md>
> 
>     I can't tell what he is saying.
> 
>     And his example wont read a carriage return
> 
> 
> That's very low level. And it's disabling icrnl, so a carriage return is 
> exactly that. \r not \n. (Same for output, it disables onlcr so \n moves 
> down a line without moving the cursor back to the left; you have to 
> output the \r yourself if you want it.)
> 
> There is no exact high level replacement for that perl 5 module *yet*. 
> There's work on a branch of https://github.com/ab5tract/terminal-print 
> for this, that I think hasn't been merged yet, much less released.
> 
> There is also a higher level gotcha: IIRC the read routine in rakudo 
> wants to read an extra character to make sure it's got a full Unicode 
> character. (Although arguably it should not in this case because there's 
> an easy way to know if you need another character or not.) But even 
> then, probably for single character input you want to set binary mode on 
> $*IN.

How do I set $*IN to binary mode?

What I am after is the dump anything in the keyboard buffer.
Then wait for a (any) response from the user.

Thread Previous


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