Skip Menu |

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

Report information
The Basics
Id: 29476
Status: new
Priority: 0/
Queue: IO-Prompt

People
Owner: Nobody in particular
Requestors: kclark [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: v0.99.4
Fixed in: (no value)



Subject: Use integers for '-menu' instead of letters
I've hacked my version of IO::Prompt to use integers instead of letters for the "-menu" items. I often have more than 26 options. ky diff Prompt.pm Prompt.orig 535a536 Show quoted text
> croak "Too many -menu items" if $count > 26;
538c539 < my $max_char = $count - 1; --- Show quoted text
> my $max_char = chr(ord('a') + $count - 1);
542c543 < my $next = 1; --- Show quoted text
> my $next = 'a';
556c557 < my $prompt_range = "(Please enter 1-$max_char) > "; --- Show quoted text
> my $prompt_range = "(Please enter a-$max_char) > ";
568c569 < elsif ($response < 1 || $response > $max_char ) { --- Show quoted text
> elsif (length $response > 1 || ($response lt 'a' ||
$response gt $max_char) ) { 575c576 < elsif ($require and my $mesg = $require->($data[$response-1])) { --- Show quoted text
> elsif ($require and my $mesg =
$require->($data[ord($response)-ord('a')])) { 581c582 < my $selection = $data[$response-1]; --- Show quoted text
> my $selection = $data[ord($response)-ord('a')];