Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Term::Prompt broken? Or am I misreading documentation? (http://www.velocityreviews.com/forums/t885119-term-prompt-broken-or-am-i-misreading-documentation.html)

Daniel M. Drucker 02-10-2004 09:51 PM

Term::Prompt broken? Or am I misreading documentation?
 
Term::Prompt appears to be either very badly broken ... or I'm
completely misreading the documentation.

Term::Prompt's menuing system really doesn't seem to behave anything
like described in the documentation.

In this script, only the first prompt displays a menu at all, and
misnumbered, at that.

Can ANYONE tell me if I'm doing something wrong, or if this is a bug
in Term::Prompt?

Daniel Drucker
dmd@3e.org

#!/usr/bin/perl

use Term::Prompt;

my @fruits = qw(apple orange pear tomato grapefruit apricot peach);

my $fruitnum = &prompt("m", {
prompt => "Choose:",
title => "Fruits",
items => [@fruits],
order => 'down',
accept_empty_selection => 0,
accept_multiple_selections => 0,
});

print "you chose " . $fruits[$fruitnum] . "\n";

print "\n=============\n";


my $fruitnum = &prompt("m", {
prompt => "Choose:",
title => "Fruits",
items => [@fruits],
order => 'down',
cols => 1,
accept_empty_selection => 0,
accept_multiple_selections => 0,
});

print "you chose " . $fruits[$fruitnum] . "\n";

print "\n=============\n";

my $fruitnum = &prompt("m", {
prompt => "Choose:",
title => "Fruits",
items => [@fruits],
order => 'across',
accept_empty_selection => 0,
accept_multiple_selections => 0,
});

print "you chose " . $fruits[$fruitnum] . "\n";

print "\n=============\n";

my $fruitnum = &prompt("m", {
prompt => "Choose:",
title => "Fruits",
items => [@fruits],
order => 'across',
rows => 1,
accept_empty_selection => 0,
accept_multiple_selections => 0,
});

print "you chose " . $fruits[$fruitnum] . "\n";

print "\n=============\n";

Bill 02-12-2004 06:16 AM

Re: Term::Prompt broken? Or am I misreading documentation?
 
Daniel M. Drucker wrote:

> Term::Prompt appears to be either very badly broken ... or I'm
> completely misreading the documentation.
>
> Term::Prompt's menuing system really doesn't seem to behave anything
> like described in the documentation.
>
> In this script, only the first prompt displays a menu at all, and
> misnumbered, at that.
>
> Can ANYONE tell me if I'm doing something wrong, or if this is a bug
> in Term::Prompt?
>
> Daniel Drucker
> dmd@3e.org
>
> #!/usr/bin/perl
>
> use Term::Prompt;
>
> my @fruits = qw(apple orange pear tomato grapefruit apricot peach);
>
> my $fruitnum = &prompt("m", {
> prompt => "Choose:",
> title => "Fruits",
> items => [@fruits],
> order => 'down',
> accept_empty_selection => 0,
> accept_multiple_selections => 0,
> });
>


I'm pretty sure that the above is not a correct call of the 'prompt'
function. Though why it behaves the way it does is unclear. What happens
if you add 'use strict'?


Daniel M. Drucker 02-14-2004 08:34 AM

Re: Term::Prompt broken? Or am I misreading documentation?
 
Bill <wherrera@lynxview.com> wrote in message news:<j4Sdnbvce-eWh7bdRVn-iQ@adelphia.com>...
> I'm pretty sure that the above is not a correct call of the 'prompt'
> function. Though why it behaves the way it does is unclear. What happens
> if you add 'use strict'?


Not sure, as I got Term::Prompt version 0.12 (in the process of being
posted to CPAN - there's been a change of package ownership that's
delayed it), which fixed the problem.

Daniel Drucker

Daniel M. Drucker 02-16-2004 05:52 PM

Re: Term::Prompt broken? Or am I misreading documentation?
 
> Not sure, as I got Term::Prompt version 0.12 (in the process of being
> posted to CPAN - there's been a change of package ownership that's


Term::Prompt 0.12 is now available on CPAN, and solves the problem I was having.

Daniel


All times are GMT. The time now is 06:01 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.