Skip Menu |

This queue is for tickets about the IO-Prompter CPAN distribution.

Report information
The Basics
Id: 118255
Status: open
Priority: 0/
Queue: IO-Prompter

People
Owner: Nobody in particular
Requestors: sinan [...] unur.com
Cc:
AdminCc:

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



Subject: IO::Prompter does not remove EOL on Windows
Date: Tue, 4 Oct 2016 08:00:45 -0400
To: bug-IO-Prompter [...] rt.cpan.org
From: "A. Sinan Unur" <sinan [...] unur.com>
Hello: Recently, while answering a question on Stackoverflow[1], I noticed an oddity on Windows: C:\> perl -MIO::Prompter -E "$x = prompt 'p: ', -echo => '*'; say qq{>>>$x<<<}" p: ******** <<<12345678 Note the password is not printed between the angle brackets, but after. C:\> perl -MIO::Prompter -E "$x = prompt 'p: ', -echo => '*'; say qq{>>>$x<<<}" | xxd 00000000: 3e3e 3e31 3233 3435 3637 380d 3c3c 3c0d >>>12345678.<<<. 00000010: 0a Note the solitary `x0d` after `x38`. I am not exactly sure why this happens, but it may have something to do with an interaction between reading in 'raw' mode[2] and 'chomp'ing[3] or where input matching `\R` is appended to the buffer[4]. I think at [4], in raw mode, the module is reading just the CR part of the CRLF. The least disruptive change might be to replace the chomp with `s/\R\z//`. HTH, -- Sinan [1]: https://stackoverflow.com/a/39801196/100754 [2]: https://metacpan.org/source/DCONWAY/IO-Prompter-0.004014/lib/IO/Prompter.pm#L1202 [3]: https://metacpan.org/source/DCONWAY/IO-Prompter-0.004014/lib/IO/Prompter.pm#L240 [4]: https://metacpan.org/source/DCONWAY/IO-Prompter-0.004014/lib/IO/Prompter.pm#L1413
CC: "A. Sinan Unur" <sinan [...] unur.com>
Subject: Re: [rt.cpan.org #118255] AutoReply: IO::Prompter does not remove EOL on Windows
Date: Tue, 4 Oct 2016 08:33:53 -0400
To: bug-IO-Prompter [...] rt.cpan.org
From: "A. Sinan Unur" <sinan [...] unur.com>
On Tue, Oct 4, 2016 at 8:01 AM, Bugs in IO-Prompter via RT <bug-IO-Prompter@rt.cpan.org> wrote: Show quoted text
> The least disruptive change might be to replace the chomp with `s/\R\z//`.
On second thought, changing: # Add newline to the accumulated input string... $input .= $next; to $input .= $/; might be better. I'll see if that causes any test failures later, and submit a patch, but it might be a while before I can get back to this. HTH, -- Sinan
Subject: Re: [rt.cpan.org #118255] AutoReply: IO::Prompter does not remove EOL on Windows
Date: Wed, 5 Oct 2016 12:06:42 +1100
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> I'll see if that causes any test failures later, and > submit a patch, but it might be a while before I can get back to this.
Take your time, Sinan. I would be very grateful for a patch, as I don't have (or want ;-) access to Windows. Much appreciated, Damian