Umph::Prompt - Interactive prompt for Umph
my @items;
push @items, {title => 'foo', url => 'http://foo', selected => 0};
push @items, {title => 'bar', url => 'http://bar', selected => 0};
my $p = new Umph::Prompt(
# Commands.
commands => {
q => sub {
my ($p, $args) = @_;
$p->exit(\@items, $args);
},
d => sub {
my ($p, $args) = @_;
$p->display(\@items, $args);
},
m => sub {
my ($p, $args) = @_;
$p->max_shown_items(@{$args});
},
s => sub {
my ($p, $args) = @_;
$p->select(\@items, $args);
},
h => sub {
my ($p, $args) = @_;
$p->help($args);
},
},
# Callbacks. All of these are optional.
ontoggle => sub {
my ($p, $args) = @_;
$p->toggle(\@items, $args);
},
onloaded => sub {
my ($p, $args) = @_;
$p->display(\@items, $args);
},
onitems => sub {return \@items},
# Other (required) settings
total_items => scalar @items,
prompt_msg => 'foo',
max_shown_items => 20
);
$p->exec;
Umph::Prompt is an interactive prompt module for umph and similar programs.
gitweb: <http://repo.or.cz/w/umph-prompt.git>
Toni Gundogdu <legatvs at sign cpan org<gt>
Umph::Prompt is free software, licensed under the LGPLv2.1+.