No problem at all. Results follow, first with backspace and then with delete:
C:\Users\danjone3
λ perl temp.pl
Hit the backspace/delete/erase key on your keyboard...
Term::ReadKey doesn't know what character ERASE is
Your system thinks ERASE is ASCII 8
That's a problem
C:\Users\danjone3
λ perl temp.pl
Hit the backspace/delete/erase key on your keyboard...
Term::ReadKey doesn't know what character ERASE is
Your system thinks ERASE is ASCII 27,91,51,126
That's a problem
(BTW, for what it's worth, I'd prefer not to be using Windows either but it's a work machine. I don't have a choice!)
Daniel D Jones
Engineer - Network
danjone3@cisco.com
Cell: 910-382-7095
Cisco Systems Limited
US
Cisco.com
Think before you print.
This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
Show quoted text-----Original Message-----
From: damian@conway.org via RT [mailto:bug-IO-Prompter@rt.cpan.org]
Sent: Monday, March 02, 2015 2:31 PM
To: 'ddjones@riddlemaster.org'; Daniel Jones -X (danjone3 - INSIGHT GLOBAL INC at Cisco)
Subject: [rt.cpan.org #102365] Re: [rt.cpan.org #102456] Bug 102365
<URL:
https://rt.cpan.org/Ticket/Display.html?id=102365 >
Hi Dan,
Thanks for the diagnostic feedback.
As controls{"ERASE"} is consistently undefined, i's clear that Term::ReadKey is not providing the necessary key information to allow IO::Prompter to handle character deletions. under Strawberry Perl (as it does successfully under Linux and MacOS).
The value you got back when hitting DELETE is weird. ASCII 27 is ESCAPE, so it's quite likely that's just the start of a multi-character sequence (or else something is horribly broken under Strawberry Perl).
Could I prevail upon you to rerun the diagnostic tests with the following
(enhanced) version of my test code:
-----cut----------cut----------cut----------cut----------cut----------cut----------cut-----
use Term::ReadKey;
use Data::Dumper 'Dumper';
say 'Hit the backspace/delete/erase key on your keyboard...';
Term::ReadKey::ReadMode('raw', *STDIN);
my $input = Term::ReadKey::ReadKey;
while (defined( my $nextchar = Term::ReadKey::ReadKey(-1) )) {
$input .= $nextchar;
}
Term::ReadKey::ReadMode('restore', *STDIN);
my %controls = Term::ReadKey::GetControlChars(*STDIN);
if (!defined $controls{ERASE}) {
say 'Term::ReadKey doesn\'t know what character ERASE is';
}
else {
say 'Term::ReadKey thinks ERASE is ASCII ', join ',', map {ord} split //,$controls{ERASE};
}
say ' Your system thinks ERASE is ASCII ', join ',', map {ord} split //, $input;
say "That's a problem" if $input ne ($controls{ERASE} // 127);
-----end----------end----------end----------end----------end----------end----------end-----
Much appreciated!
Damian