FAQ
Hi,

Having used CPAN for a long time, I'd like to contribute my first module to her. Could you please help me on the namespace? May I use namespace Hierarchy? If it is used by others, may it be shared?

I named the module Hierarchy::Traverser on my local lib of my local machine:-. Currently, it has only one recursive function hierarchy_traverse, for provide an interface for traersing across any kind hierarchy structure (see the interface below). Later on, I may make it OO ("a pair of big gOO-gOO eyes", the very funny term to my son, is popping out in my mind 8-); and add more functionalities and/or other modules under this namespace.

Ge Peng (TIGERPERL)



hierarchy_traverse (
$roots, # a scalar for one root,
# or a ref to a list of roots,
# or a ref to a list of the wrappers of root.
\&get_children, # a function for getting child nodes
{ # Options:
depth => 1, # The depth limitaion. (default undef, no limitation)
pre_branch => $per_banch_function, # the function called before visit childeren nodes
post_branch => $per_banch_function, # the fucntion called after visite all it children nodes
bare_branch => $per_banch_function, # the function for empty branches
leaf => $leaf_function, # the function for leaf nodes
is_leaf => $is_leaf_function, # the function for check if a node is leaf
# all default functions are default to be {}
# (do nothing and return false.
# (?Should it just skip the call to an empty funcion?)
} ,
);

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodules @
categoriesperl
postedOct 19, '06 at 2:12p
activeOct 19, '06 at 2:12p
posts1
users1
websitecpan.org...

1 user in discussion

Tiger peng: 1 post

People

Translate

site design / logo © 2021 Grokbase