D
Dr.Ruud
Ilya Zakharevich schreef:
I assumed that merely running both! the tests (on the mentioned
perl-version) would show you what I noticed.
Did you run them? Add $in as the Filehandle parameter to each ReadKey,
if you think that is a better test.
The first works "erratic" (not really erratic, see perldoc -f getc), so
the same as with getc. The second works as I would expect (Enter and
Ctrl-M give 13, Ctrl-J gives 10, no delays, etc.) because it AFAIK
doesn't use getc.
I assume that is Term::ReadLine:erl. What is the reason to do the test
with Term::ReadKey?
Not 0e0, but '0E0'.
if (0) { print "0: true\n" };
if ('0') { print "'0': true\n" };
if (0E0) { print "0E0: true\n" };
if ('0E0') { print "'0E0':true\n" };
Only the last one should print true. When MODE eq '0E0', ReadKey() takes
a subt(i)le different code path.
if ($_[0]) {
Win32PeekChar($File, $_[0]);
} else {
getc $File;
}
With '0E0' (I assume that) the $_0 tests true, so Win32PeekChar() is
used.
Not to me.
Dr.Ruud:
Eh? All your message contained was "I tested THIS code". No
information about the testing was contained.
I assumed that merely running both! the tests (on the mentioned
perl-version) would show you what I noticed.
Did you run them? Add $in as the Filehandle parameter to each ReadKey,
if you think that is a better test.
I do not follow again. Is the result the same, or one `is "erratic"',
other not? And IS it the same as with getc?
The first works "erratic" (not really erratic, see perldoc -f getc), so
the same as with getc. The second works as I would expect (Enter and
Ctrl-M give 13, Ctrl-J gives 10, no delays, etc.) because it AFAIK
doesn't use getc.
Because T:R uses getc().
I assume that is Term::ReadLine:erl. What is the reason to do the test
with Term::ReadKey?
See perldoc Term::ReadKey, under ReadKey MODE [, Filehandle], at the
end it mentions Windows and getc.
Did not find any mention of what you suggest (0 vs 0e0, Win and getc)
in 2.30.
Not 0e0, but '0E0'.
if (0) { print "0: true\n" };
if ('0') { print "'0': true\n" };
if (0E0) { print "0E0: true\n" };
if ('0E0') { print "'0E0':true\n" };
Only the last one should print true. When MODE eq '0E0', ReadKey() takes
a subt(i)le different code path.
if ($_[0]) {
Win32PeekChar($File, $_[0]);
} else {
getc $File;
}
With '0E0' (I assume that) the $_0 tests true, so Win32PeekChar() is
used.
Again, this looks like contradicting the other parts of your message.
Not to me.