Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: jan.husarcik [...] gmail.com
Cc:
AdminCc:

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



Subject: -yn and -default = default is always used
Date: Mon, 18 Jul 2016 22:42:13 +0200
To: bug-io-prompter [...] rt.cpan.org
From: Ján Husarčík <jan.husarcik [...] gmail.com>
Hello, when I use if ( prompt( "Do you want to do it?", -yesno, -stdio, -default => 'y' ) ) { doSomething(); } else { doNotDoIt(); } doSomething() is always performed, even if I enter 'n'. Without -default it behaves as expected IO::Prompter 0.004014 Could you please have a look? Thanks, Jan
Subject: Re: [rt.cpan.org #116301] -yn and -default = default is always used
Date: Tue, 19 Jul 2016 06:57:20 +1000
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Jan, I'm sorry you're having trouble with the module. However I cannot replicate the problem your reporting under Perl 5.14, 5.20, or 5.24 on MacOSX. For example, this code: use IO::Prompter; while (1) { if ( prompt( "Do you want to do it?", -yesno, -stdio, -default => 'y' ) ) { say '--> yes'; } else { say '--> no'; } } produces: Do you want to do it? y --> yes Do you want to do it? n --> no Do you want to do it? <return> --> yes as expected. What version of Perl and what OS are you using? Damian
Subject: Re: [rt.cpan.org #116301] -yn and -default = default is always used
Date: Tue, 19 Jul 2016 02:33:25 +0200
To: bug-IO-Prompter [...] rt.cpan.org
From: Ján Husarčík <jan.husarcik [...] gmail.com>
Thanks a lot for your prompt reply, Damian. Unfortunately, your sample produces the very same issue for me. Attaching the screenshot. OS: Win7x64 Perl: 5, version 24, subversion 0 (v5.24.0) built for MSWin32-x64-multi-thread Problem seems to be, that # If input timed out insert the default, if any... my $timedout = $in_pos == do{ no warnings; tell $in_filehandle } // 0; if ($timedout && exists $opt_ref->{-def}) { $input = $opt_ref->{-def}; $defaulted = 1; } sets $input to value of -default Jan On Mon, Jul 18, 2016 at 10:58 PM, damian@conway.org via RT < bug-IO-Prompter@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=116301 > > > Hi Jan, > > I'm sorry you're having trouble with the module. > > However I cannot replicate the problem your reporting > under Perl 5.14, 5.20, or 5.24 on MacOSX. > > For example, this code: > > use IO::Prompter; > > while (1) { > if ( prompt( "Do you want to do it?", -yesno, -stdio, -default => > 'y' ) ) { > say '--> yes'; > } > else { > say '--> no'; > } > } > > produces: > > Do you want to do it? y > --> yes > Do you want to do it? n > --> no > Do you want to do it? <return> > --> yes > > as expected. > > What version of Perl and what OS are you using? > > Damian > >
Download prompt.PNG
image/png 7.6k

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #116301] -yn and -default = default is always used
Date: Tue, 19 Jul 2016 15:44:53 +1000
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Jan, I see you're on Windows. That's the problem. IO::Prompter relies on Unix I/O semantics from filehandles and doesn't seem to play nice with Windows. I don't have (or want! ;-) access to that OS, so I don't really have a way to help you overcome this issue. :-( Others have reported more luck with IO::Prompt::Simple under Windows. Perhaps you should give that a try? Sorry not to be of more help, Damian
Subject: Re: [rt.cpan.org #116301] -yn and -default = default is always used
Date: Tue, 19 Jul 2016 11:15:53 +0200
To: bug-IO-Prompter [...] rt.cpan.org
From: Ján Husarčík <jan.husarcik [...] gmail.com>
Hi Damian, thanks for info anyway. Maybe it would be good to include this info in the documentation, for other users to be aware of limitation. Regards, Jan On Tue, Jul 19, 2016 at 7:45 AM, damian@conway.org via RT < bug-IO-Prompter@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=116301 > > > Hi Jan, > > I see you're on Windows. That's the problem. IO::Prompter relies on > Unix I/O semantics from filehandles and doesn't seem to play nice > with Windows. > > I don't have (or want! ;-) access to that OS, so I don't really have a > way to help you overcome this issue. :-( > > Others have reported more luck with IO::Prompt::Simple under Windows. > Perhaps you should give that a try? > > Sorry not to be of more help, > > Damian > >
Subject: Re: [rt.cpan.org #116301] -yn and -default = default is always used
Date: Wed, 20 Jul 2016 10:44:31 +1000
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> thanks for info anyway. Maybe it would be good to include this info in the > documentation, for other users to be aware of limitation.
Will do, Jan. Damian