diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-01-30 01:29:44 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-01-30 01:29:44 +0000 |
commit | 612847f81d74f641b49aa93b88b567318ba0fcfa (patch) | |
tree | d2d74cbba3333c5672ae80f340b121bc8c2c4d2d | |
parent | c39550022f9081a65c97b9021f88cff87fe0f0bb (diff) | |
download | drakx-backup-do-not-use-612847f81d74f641b49aa93b88b567318ba0fcfa.tar drakx-backup-do-not-use-612847f81d74f641b49aa93b88b567318ba0fcfa.tar.gz drakx-backup-do-not-use-612847f81d74f641b49aa93b88b567318ba0fcfa.tar.bz2 drakx-backup-do-not-use-612847f81d74f641b49aa93b88b567318ba0fcfa.tar.xz drakx-backup-do-not-use-612847f81d74f641b49aa93b88b567318ba0fcfa.zip |
(helper_separator_tree_to_tree): this new function helps transforming a
flag {list} to a tree, using {separator}
-rw-r--r-- | perl-install/interactive.pm | 26 |
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; |