From 10b649b6503f47388f1548c8ba9391dd6ce0284e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 24 Aug 1999 19:02:16 +0000 Subject: no_comment --- perl-install/interactive.pm | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'perl-install/interactive.pm') diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index b0bd6bb7d..70f54b57b 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -5,6 +5,26 @@ use strict; use common qw(:common :functional); +# heritate from this class and you'll get all made interactivity for same steps. +# for this you need to provide +# - ask_from_listW(o, title, messages, arrayref, default) returns one string of arrayref +# - ask_many_from_listW(o, title, messages, arrayref, arrayref2) returns one string of arrayref +# +# where +# - o is the object +# - title is a string +# - messages is an refarray of strings +# - default is an optional string (default is in arrayref) +# - arrayref is an arrayref of strings +# - arrayref2 contains booleans telling the default state, +# +# ask_from_list and ask_from_list_ are wrappers around ask_from_biglist and ask_from_smalllist +# +# ask_from_list_ just translate arrayref before calling ask_from_list and untranslate the result +# +# ask_from_listW should handle differently small lists and big ones. + + 1; sub new($$) { @@ -41,12 +61,20 @@ sub ask_from_list($$$$;$) { $o->ask_from_listW($title, $message, $l, $def || $l->[0]); } +sub ask_many_from_list_ref($$$$;$) { + my ($o, $title, $message, $l, $val) = @_; + + $message = ref $message ? $message : [ $message ]; + + $o->ask_many_from_list_refW($title, $message, $l, $val); +} sub ask_many_from_list($$$$;$) { my ($o, $title, $message, $l, $def) = @_; - $message = ref $message ? $message : [ $message ]; + my $val = [ map { my $i = $_; \$i } @$def ]; - $o->ask_many_from_listW($title, $message, $l, $def); + $o->ask_many_from_list_ref($title, $message, $l, $val) ? + [ map { $$_ } @$val ] : undef; } sub ask_from_entry($$$;$) { -- cgit v1.2.1