Skip Menu |

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

Report information
The Basics
Id: 4357
Status: new
Priority: 0/
Queue: Term-Prompt

People
Owner: Nobody in particular
Requestors: toni [...] socialtools.net
Cc:
AdminCc:

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



Subject: multi choice menu doesn't get printed at all!
Hi, distribution: Term-Prompt-0.11 perl: v5.8.1 built for i686-linux OS: Linux 2.4.18-bf2.4 i686 GNU/Linux It's a Debian testing, meaning all the latest packages. Following code, taken from your documentation, fails: CODE: ================================================= #!/usr/local/bin/perl -w use strict; use Term::Prompt; my $r = &prompt ("m", { prompt => "text prompt", title => 'My Silly Menu', items => [ qw (foo bar baz biff spork boof akak) ], order => 'down', rows => 1, cols => 1, display_base => 1, return_base => 0, accept_multiple_selections => 0, accept_empty_selection => 0 }, "help prompt", "spork"); ================================================= PRINTS OUT: ================================================= My Silly Menu ------------- text prompt (help prompt) [default spork] =================================================== i.e. menu never gets printed at all! I've used simple y/n prompts and they were ok, however i need multichoice menues too. If you do fix this, please let me know, i'd love to be able to use the module, as, like any other good module, saves great deal of code. thanks, toni
From: Peter Oliver
[guest - Tue Nov 11 08:52:42 2003]: Show quoted text
> Hi, > > distribution: Term-Prompt-0.11 > perl: v5.8.1 built for i686-linux > OS: Linux 2.4.18-bf2.4 i686 GNU/Linux > It's a Debian testing, meaning all the latest packages. > > Following code, taken from your documentation, fails: > > CODE: > ================================================= > #!/usr/local/bin/perl -w > > use strict; > use Term::Prompt; > > my $r = &prompt > ("m", > { > prompt => "text prompt", > title => 'My Silly Menu', > items => [ qw (foo bar baz biff spork boof akak) > ], > order => 'down', > rows => 1, > cols => 1, > display_base => 1, > return_base => 0, > accept_multiple_selections => 0, > accept_empty_selection => 0 > }, > "help prompt", "spork"); > ================================================= > > PRINTS OUT: > ================================================= > > My Silly Menu > ------------- > > text prompt (help prompt) [default spork] > =================================================== > > i.e. menu never gets printed at all! > > I've used simple y/n prompts and they were ok, however i need > multichoice menues too. If you do fix this, please let me know, i'd > love to be able to use the module, as, like any other good module, > saves great deal of code.
That code *can't* work, since it fixes both the number of rows and the number of columns to 1. However, menus really are broken. For example: Show quoted text
> perl -e 'use Term::Prompt; print prompt( "m", { prompt => "this is a
prompt", title => "this is a title", items => [ qw( one two three four five six seven eight nine ten ) ], order => "down", }, undef, undef )' this is a title --------------- 1) one 3) three 5) five 7) seven 9) nine 2) two 4) four 6) six 8) eight 10) ten this is a prompt (1 - 10) and: mepc5f2a:~> perl -e 'use Term::Prompt; print prompt( "m", { prompt => "this is a prompt", title => "this is a title", items => [ qw( one two three four five six seven eight nine ten ) ], order => "across", }, undef, undef )' this is a title --------------- 1) one 8) eight 2) two 8) eight 3) three 8) eight 4) four 8) eight 5) five 8) eight 6) six 8) eight 7) seven 8) eight 9) nine 10) ten this is a prompt (1 - 10) The attatched patch seems to fix the problem.
--- Prompt.pm~ Fri Nov 14 13:03:22 2003 +++ Prompt.pm Fri Nov 14 13:03:22 2003 @@ -205,11 +205,11 @@ if (defined($menu_out[$row][$col])) { printf($column_end_fmt,$menu_out[$row][$col]); } - if (defined($menu_out[$row][$num_cols-1])) { - printf($line_end_fmt,$menu_out[$row][$num_cols-1]); - } else { - print "\n"; - } + } + if (defined($menu_out[$row][$num_cols-1])) { + printf($line_end_fmt,$menu_out[$row][$num_cols-1]); + } else { + print "\n"; } }