Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

kbhit() in Perl???

0 views
Skip to first unread message

Ernst Studer

unread,
Nov 1, 2001, 4:16:25 PM11/1/01
to
Hy

Does anybody know, how to write the kbhit() function of C/C++ in Perl?
The function has to be usable for Unix/Linux...(so, it's not the same like
in conio.h of C/C++)

Functionality:
Return value is 0 when no key was pushed.
If a key was pushed, return value is != 0.

I hope someone has an answer for me.

Roman


Philip Newton

unread,
Nov 3, 2001, 2:28:48 PM11/3/01
to
[Please set a "Followup-To" header when you crosspost, especially if you
feel the need to crosspost this widely. This message only goes to
comp.lang.perl.modules.]

On Thu, 1 Nov 2001 22:16:25 +0100, "Ernst Studer"
<studer...@zik5722.ch> wrote:

> Does anybody know, how to write the kbhit() function of C/C++ in Perl?

Have a look in the Perl FAQ. `perldoc -q key` yields several bits of
useful code; one of them is `perldoc -q "input is ready"`.

Cheers,
Philip
--
Philip Newton <nospam...@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.

Jonathan Stowe

unread,
Nov 4, 2001, 5:22:43 AM11/4/01
to

The module Term::Screen has a method key_pressed() that does exactly this.

/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|

0 new messages