Skip Menu |

This queue is for tickets about the Term-UI CPAN distribution.

Report information
The Basics
Id: 68168
Status: new
Priority: 0/
Queue: Term-UI

People
Owner: Nobody in particular
Requestors: info [...] michael-knaus.de
Cc:
AdminCc:

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



Subject: Default not working for numeric choices with more than one digit
Date: Fri, 13 May 2011 09:03:45 +0200
To: bug-Term-UI [...] rt.cpan.org
From: Michael Knaus <info [...] michael-knaus.de>
Hello, first, please see subject. This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32-x86-multi-thread (with 9 registered patches, see perl -V for more detail) Term::UI Version: '0.26' OS is Windows XP 32 bit ==================== Sample Code: ======================== use strict; use warnings; use Term::UI; use Term::ReadLine; my $term = Term::ReadLine->new('Why is this needed?', \*STDIN, \*STDERR); local $Term::UI::History::HISTORY_FH = \*STDERR; my $reply; #here default is not working $reply = $term->get_reply( prompt => 'How many?', choices => [ 5, 10, 20, 40], default => 20, ); print $reply, "\n"; #here default is not working $reply = $term->get_reply( prompt => 'How many?', choices => [qw| 5 10 20 40|], default => '20', ); print $reply, "\n"; #here default is not shown, but working $reply = $term->get_reply( prompt => 'How many?', choices => [ 5, 10, 20, 40], default => 3, #means 20 ); print $reply, "\n"; ========= results ================== d:\masked>bugReportTermUI.pl Show quoted text
1> 5
Show quoted text
2> 10
Show quoted text
3> 20
Show quoted text
4> 40
How many? [3]: Invalid selection, please try again: [3] Invalid selection, please try again: [3] 3 20 Show quoted text
1> 5
Show quoted text
2> 10
Show quoted text
3> 20
Show quoted text
4> 40
How many? [3]: Invalid selection, please try again: [3] Invalid selection, please try again: [3] 3 20 Show quoted text
1> 5
Show quoted text
2> 10
Show quoted text
3> 20
Show quoted text
4> 40
How many? 20 =========== End or results ============== Kind regards Michael