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 9, 2017 19:55
Subject:
Re: What is P6 for P5 `use Term::ReadKey`?
Message ID:
80b5fdb8-899e-3e11-a46c-a15dd14b1059@zoho.com
On 09/09/2017 07:00 AM, Timo Paulssen wrote:
> This should be enlightening: https://docs.perl6.org/routine/getc
> 

Hi Timo,

 From the link:

     Buffering terminals

     Using getc to get a single keypress from a terminal will
     only work properly if you've set the terminal to
     "unbuffered". Otherwise the terminal will wait for the
     return key to be struck or the buffer to be filled up
     before perl6 gets even a single byte of data.

This is exactly what I am after.

Problem: also from the link:

     method getc(IO::Handle:D: --> Str:D)
     multi sub getc (IO::Handle $fh = $*ARGFILES --> Str:D)

This is very frustrating to me as it mean ABSOLUTELY NOTHING
to me.  Without an example, which the link does not provide,
I have not the slightest idea what they are talking about.

Would you mind jotting down an example of how to read
a key press?


Many thanks,
-T

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