summaryrefslogtreecommitdiffstats
path: root/perl-install/interactive.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-01-30 01:29:44 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-01-30 01:29:44 +0000
commit612847f81d74f641b49aa93b88b567318ba0fcfa (patch)
treed2d74cbba3333c5672ae80f340b121bc8c2c4d2d /perl-install/interactive.pm
parentc39550022f9081a65c97b9021f88cff87fe0f0bb (diff)
downloaddrakx-612847f81d74f641b49aa93b88b567318ba0fcfa.tar
drakx-612847f81d74f641b49aa93b88b567318ba0fcfa.tar.gz
drakx-612847f81d74f641b49aa93b88b567318ba0fcfa.tar.bz2
drakx-612847f81d74f641b49aa93b88b567318ba0fcfa.tar.xz
drakx-612847f81d74f641b49aa93b88b567318ba0fcfa.zip
(helper_separator_tree_to_tree): this new function helps transforming a
flag {list} to a tree, using {separator}
Diffstat (limited to 'perl-install/interactive.pm')
-rw-r--r--perl-install/interactive.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 5285781ab..c32553a88 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -425,4 +425,30 @@ sub wait_message {
sub kill {}
+
+
+sub helper_separator_tree_to_tree {
+ my ($separator, $list, $formatted_list) = @_;
+ my $sep = quotemeta $separator;
+ my $tree = {};
+
+ each_index {
+ my @l = split $sep;
+ my $leaf = pop @l;
+ my $node = $tree;
+ foreach (@l) {
+ $node = $node->{$_} ||= do {
+ my $r = {};
+ push @{$node->{_order_}}, $_;
+ $r;
+ };
+ }
+ push @{$node->{_leaves_}}, [ $leaf, $list->[$::i] ];
+ ();
+ } @$formatted_list;
+
+ $tree;
+}
+
+
1;