Term::Prompt broken? Or am I misreading documentation?

D

Daniel M. Drucker

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
(e-mail address removed)

#!/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";
 
B

Bill

Daniel said:
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
(e-mail address removed)

#!/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'?
 
D

Daniel M. Drucker

Bill said:
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
 
D

Daniel M. Drucker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top