= POD = Item
@ surult = (); $ ldap_root = "nta :: ou1"; push @Result, "NTA :: OU1 :: u2 :: ou3"; push @Result, "NTA :: OU1 :: u2 :: u4";
Push @Result, "NTA :: Ou1 :: u5 :: ou6"; push @Result, "NTA :: Ou1 :: u5 :: u6 :: o8"; push @Result, "NTA :: OU1 :: OU5: : OU6 :: o9 "; Push @Result," NTA :: OU1 :: u5 :: ou7 "; push @Result," NTA :: OU1 :: u5 :: u7 :: t "; push @Result," NTA :: OU1 :: u5 :: u7 :: t :: y "; push @Result," NTA :: Ou1 :: u5 :: u7 :: t :: Y :: U ";
Push @Result, "NTA :: OU1 :: u6 :: u8"; Push @Result, "NTA :: OU1 :: u6 :: u8 :: ji"; push @Result, "NTA :: u1 :: U6: : OU8 :: Ji :: JK "; Push @Result," NTA :: OU1 :: u6 :: u::::::::::::::::::::::::::::::::::::::::::: = CUT ########################################################################################################################################################################################################################################################################################## ######## Sub recusive_ldap {my% param = @ _; my $ left_list = $ param {left_list}; # a array to put the left string in, use @ $ @ @ ip @ @ $ @ @ ip = $ param {LEFT}; my $ right = $ param {right}, my $ r_ldap_array = $ param {r_ldap_array}; # us $$ to use this ref my $ r_rid = $ param {r_rid}; #use $$ to use it my my my $ prefix = $ param {prefix};
Find_DIFF:
My @ Found = ();
MY $ CURRENT_GROUP;
My @ merge_list = (); my $ fact_group_idx = -1; my $ found_new_group = 0; #begin a new match my $ matched_new_group = 0; My $ begin_match = 0; My ($ left_idx, $ right_idx);
MY $ blank_item = 0;
Curr: for (MY $ I = $ LEFT; $ I IF (@ $ left_list [$ I] ne '') {@ $ left_list [$ i] = ~ / :: /; $ current_group = $ '; IF ($ current_GROUP = ~ / :: /) {$ current_group = $ `; } } Else {#last node impossible to be a faather nodwa $ current_group = undef; $ blank_item ; Next curr; # get next item} IF (scalar @ Found == 0) {#first item IF (defined $ current_group) {$ begin_match = 1; push @found, $ current_group; $ DIFF_GROUP_IDX ; $ LEFT_IDX = $ i; IF ((scalar @found == 1) && ($ i == $ right-1)) {MY $ merge = {}; $ merge -> {ip} = $ {Blank_Item; $ merge -> {right} = $ i 1; push @ merge_list, $ merge; #storage the merge of the current node} NEXT CURR; } Else {#matched a group and meet a new GRP IF ($ cut_group ne $ solid [$ diff_group_idx]) {# a new node push @found, $ current_group; $ left_idx = $ i if $ begin_match; $ begin_match = 0; $ DIFF_GROUP_IDX ; $ right_idx = $ i; if (scalar @ found == 2) { MY $ merge = {}; $ merge -> {left} = $ l it}; $ merge -> {right} = $ i; push @ merge_list, $ merge; current node } Else {MY $ merge = {}; $ merge -> {left} = $ left_idx; $ merge -> {right} = $ i; push @ merge_list, $ merge; #storage the mer @Steorage } IF ($ I == $ Right-1) {#Last Match My $ Merge = {}; if (Scalar @found> 1) {$ Merge -> {Left} = $ right_idx;} else {$ merge -> { Left} = $ l } _ it it;} = $ i 1; push @ merge_list, $ merge; #storage the merge of the current node } $ left_idx = $ i; } Else {# Continue to match the Same Father Node IF ($ I == $ Right-1) {#Last Matcha my $ merge = {}; if (scalar @found == 1) {$ merge -> {left} = $ LEFT $ blank_item;} else {$ merge -> {left} = $ right_idx;} $ merge -> {right} = $ i 1; push @ merge_list, $ merge; #storage the merge of the current node}} }} # Find all GRPS (DIFFERENT) Return if scalar @ Found == 0; My $ rid = 0; My $ blank = []; my $ current; my @g_array; #Print Dumper $ left_list; #print Dumper / @ Merge_List; Create_node: for (My $ DIFF_GRP = 0; $ DIFF_GRP My @ ldgarray = (); MY $ CUR_GRP = $ FOUND [$ DIFF_GRP]; MY $ reg = "::" $ cur_grp; $ reg = reg_encode ($ REG); For (MY $ GIDX = $ MERGE_LIST [$ DIFF_GRP] -> {Left}; $ GIDX <$ MERGE_LIST [$ DIFF_GRP] -> {right}; $ GIDX ) {@ $ left_list [$ GIDX] = ~ s / ^ $ REG / /; # Stript out this item} MY $ new_prefix = $ prefix. $ cur_grp. "::"; MY $ new_cap = $ prefix. $ cur_grp; IF ($ MERGE_LIST [$ DIFF_GF_GRP] -> {Left} == $ MERGE_LIST [$ DIFF_GRP] -> {right = _creat_node ('gx_l'. $$ R_RID, $ CUR_GRP, 0, 1, ' ',' edit_group.cgi? Name = '. $ new_cap. "& m_i = gxl _ $$ r_rid"); $$ r_rid ; Push @ $ r_ldap_Array, $ item; # put the new node to the contacter } Else {& recusive_ldap (left_list => $ left_list, left => $ merge_list [$ diff_grp] -> {left}, right => $ merge_list [$ diff_grp] -> {right}, r_ldap_array => / @ ldgArray, r_rid = > $ r_rid, prefix => $ new_prefix); MY $ item = _CREAT_NODE ('gx_l'. $$ r_rid, $ cur_grp, 1, 1, / @ ldgarray, 'edit_group.cgi? Name ='. $ new_cap. "& m_i = gxl _ $$ r_rid"); $$ r_rid ; push @ $ r_ldap_Array, $ item; # put the new node to the contact} } } ######################################################################################################################################################################################################################################################################################################## ##################################################################################################################### A menu Tree my $ node = {}; #print "add"; # essential field # $ node -> {'name'} = Translate Shift; $ node -> {'name'} = shift; $ node -> {'info'} -> {'text'} = shift; #info field $ node -> {'info'} -> {'isparent'} = shift; $ node -> {'info'} -> {'linkout'} = shift; #extra field #if is parent this field shouldn't be '' # this parameter can be becometer or an array of node $ node -> {'children'} = Shift; # default a ref to array #if The menu Linkout this Field Shouldn't Be Blank $ Node -> {'Info'} -> {'URL'} = Shift; IF ($ node -> {'children'} ne '') { IF ((Ref $ Node -> {'CHildren') Ne "Array") {# it's a hash ref my @ar; push @ar, $ node -> {'children'}; $ node -> {'children '} = / @ Ar;} else {}} else {#if a blank is pass to a' children 'Field delete this field delete $ node -> {' children '}; Return $ Node;} 1;