tomazos has asked for the wisdom of the Perl Monks concerning the following question:
How do you perform a non-blocking read from standard input?
I want to write an interactive script that I am going to run from a command-line.
I want it to do things and read input keystrokes that may be present at the same time.
To do this, I believe the best way would be to setup a tight loop that alternated between testing if there are any characters on the input and going on with it's tasks at the same time.
In order to do that I would need a call (similar to the flock non-blocking flag) that would tell me if new input is present yet and return immediately if it is not.
Any ideas?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Non-blocking read
by wog (Curate) on Nov 12, 2001 at 23:11 UTC | |
Re: Non-blocking read
by kwoff (Friar) on Nov 12, 2001 at 22:43 UTC | |
Re: Non-blocking read
by Anonymous Monk on Nov 13, 2001 at 19:29 UTC |
Back to
Seekers of Perl Wisdom