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

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

Thread Previous | Thread Next
September 9, 2017 19:55
Re: What is P6 for P5 `use Term::ReadKey`?
Message ID:
On 09/09/2017 07:00 AM, Timo Paulssen wrote:
> This should be enlightening:

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,

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