Skip Menu |

This queue is for tickets about the TermReadKey CPAN distribution.

Report information
The Basics
Id: 17885
Status: rejected
Priority: 0/
Queue: TermReadKey

People
Owner: jns [...] gellyfish.co.uk
Requestors: christopher [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.30
Fixed in: (no value)



Subject: unexpected behaviour mixing ReadKey(-1) and ReadKey(0)
The following program A) Works if you type any key faster than 2 seconds after running it B) Fails if you wait 3 seconds or more (ends after returing undef from the "blocking" read even though I type nothing!) I'm using RedHat ES3.5 Linux (2.4.21-32.0.1.ELsmp) and connecting as root via SSH. Interestingly: the exact same program on Fedora Core 4 (2.6.11- 1.1369_FC4smp), as the same user (root), with an identical bash "env" works fine. #!perl use Term::ReadKey(2.30); # :-( not exported... print "Using Term::ReadKey Versions $Term::ReadKey::VERSION\n"; ReadMode 3; # cbreak mode local $|=1; # make STDOUT go out immediately. print "Yeah?"; sleep 2; # Give us time to shove some keys into the buffer $key=ReadKey(-1); # Flush one char $buf=ReadKey(0); # Blocking read print " I flushed '$key' and got '$buf'\n"; ReadMode 0; # Reset
On Mon Feb 27 14:18:15 2006, guest wrote: Show quoted text
> The following program > A) Works if you type any key faster than 2 seconds after running it > B) Fails if you wait 3 seconds or more (ends after returing undef from > the "blocking" read even though I type nothing!) > > I'm using RedHat ES3.5 Linux (2.4.21-32.0.1.ELsmp) and connecting as > root via SSH. > > Interestingly: the exact same program on Fedora Core 4 (2.6.11- > 1.1369_FC4smp), as the same user (root), with an identical bash "env" > works fine. >
This is a bit tricky as I don't have that platform to test on and it works fine for me here. Can you try building the module on the RedHat system with perl Makefile.PL DEFINE=-DDONT_USE_SELECT and see what happens? Also it would be useful if you could let me have the output from "perl -V" on the failing system as well as the output from running the test program with "perl -d:Trace" to find out what is happening inside Term::ReadKey. I might come back with some more questions depending on my investigations. Thanks.
Don't think this can be replicated