Comments (6)
I can't easily fix it without a windows installation, this does look somewhat like a bug in StrawberryPerl.
I think the best I will be able to do is treat 0 > $ < 1 as 1
from termreadkey.
I've opened a StrawberryPerl bug:
https://rt.cpan.org/Public/Bug/Display.html?id=120043
from termreadkey.
It may be useful if you could paste the generated verision of the ReadKey from the installed ReadKey.pm as it's not clear which one would be used with SP :)
from termreadkey.
The Strawberry Perl upstream's response to my report:
On a MSWin32 ReadKey function looks like this:
sub ReadKey {
my $File = normalizehandle((@>1?$[1]:*STDIN));
if ($[0] || $CurrentMode >= 3) {
Win32PeekChar($File, $[0]);
} else {
getc $File;
}
}where Win32PeekChar looks like this:
SV * Win32PeekChar(file, delay)
InputStream file
U32 delay <<<<<<<<<<<<<<<<< the trouble!!!
CODE:
{
char key;
if (Win32PeekChar(aTHX_ file, delay, &key))
RETVAL = newSVpv(&key, 1);
else
RETVAL = newSVsv(&PL_sv_undef);
}
OUTPUT:
RETVALSo calling something like this:
my $x = ReadKey(1e-5);
means that the delay value 1e-5 is converted to U32 (unsigned 32bit integer) which I guess would be 0 (zero), therefore the same as calling my $x = ReadKey(0) - which is exactly what it does (blocking read waiting till you hit any key).
As for the versions:
- Strawberry Perl 5.20.1.1 has TermReadKey-2.31
- Strawberry Perl 5.24.1.1 has TermReadKey-2.37
And if you compare 2.31 vs. 2.37 you will find:
-int Win32PeekChar(PerlIO *file,double delay,char *key)
+int Win32PeekChar(pTHX_ PerlIO *file,U32 delay,char *key)Note "double delay" vs. "U32 delay"
So IMHO definitely not a bug Strawberry Perl. ReadKey's Win32PeekChar needs a fix.
from termreadkey.
I'll need to check why that was changed like that in the first place.
from termreadkey.
Thanks for the merge!
from termreadkey.
Related Issues (19)
- CPAN Pull Request Challenge HOT 4
- -> FAIL Installing Term::ReadKey failed. HOT 16
- GetTerminalSize() call looks for too many arguments HOT 1
- License terms probably more lenient than artistic HOT 6
- MinGW/dmake: removes cchars.h before compiling HOT 12
- thread-safe or not? HOT 2
- Problem building with perl 5.24.0 HOT 7
- Not being indexed HOT 1
- 2.34 onward not parallel build friendly
- Track minimum version of ExtUtils::MakeMaker HOT 6
- ReadKey -1 is blocking (ActiveState/Windows7) HOT 2
- Why does META.yml claim to provide the Term::ReadKey package? HOT 10
- Win32 term width HOT 1
- "make test" stops and fails if it runs as a background process
- Confusing License
- Tests hang at t/02_terminal_functions.t under cygwin HOT 1
- Can't install on Mac. HOT 2
- missing check for undefined values on win32
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from termreadkey.