summaryrefslogtreecommitdiff
path: root/lib/Config/HAProxy/Iterator.pm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-07-08 22:16:49 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-07-08 22:16:49 +0300
commit69ff9c1766ed89edf0ffdb63bf487396b6bd081b (patch)
treeef644a810f50d81d3b4e47d7cdbf64df976d8be6 /lib/Config/HAProxy/Iterator.pm
parent32b6c6394dc6a789826bd51575d9703bb4097f70 (diff)
downloadconfig-haproxy-69ff9c1766ed89edf0ffdb63bf487396b6bd081b.tar.gz
config-haproxy-69ff9c1766ed89edf0ffdb63bf487396b6bd081b.tar.bz2
Add documentationv1.00
Diffstat (limited to 'lib/Config/HAProxy/Iterator.pm')
-rw-r--r--lib/Config/HAProxy/Iterator.pm68
1 files changed, 68 insertions, 0 deletions
diff --git a/lib/Config/HAProxy/Iterator.pm b/lib/Config/HAProxy/Iterator.pm
index 6b0208e..6d80dd9 100644
--- a/lib/Config/HAProxy/Iterator.pm
+++ b/lib/Config/HAProxy/Iterator.pm
@@ -63,6 +63,74 @@ sub next {
63} 63}
64 64
651; 651;
66__END__
67
68=head1 NAME
69
70Config::HAProxy::Iterator - Iterate over objects in the parse tree
71
72=head1 SYNOPSIS
73
74 $cfg = Config::HAProxy->new->parse;
75 $itr = $cfg->iterator(inorder => 1);
76 while (defined(my $node = $itr->next)) {
77 # Do something with $node
78 }
79
80=head1 DESCRIPTION
81
82The iterator object provides a method for iterating over all nodes in the
83HAProxy parse tree. The object is returned by the B<iterator> method of
84B<Config::HAProxy> and B<Config::HAProxy::Node> objects. The method takes
85as optional argument the keyword specifying the order in which the tree nodes
86should be traversed. This keyword can be one of the following:
87
88=over 4
89
90=item B<recursive =E<gt> 0>
91
92No recursion. The traversal will not descend into section nodes. This is the
93default.
94
95=item B<inorder =E<gt> 1>
96
97The nodes will be traversed in the inorder manner, i.e. the section node
98will be visited first, and all its sub-nodes after it.
99
100=item B<postorder =E<gt> 1>
101
102The nodes will be traversed in the postorder manner, i.e. for each section
103node, its sub-nodes will be visited first, and the node itself afterward.
104
105=back
106
107=head1 CONSTRUCTOR
108
109Note: This section is informative. You never need to create
110B<Config::HAProxy::Iterator> objects explicitly. Please use the B<iterator>
111method of B<Config::HAProxy> or B<Config::HAProxy::Node> class objects.
112
113 $itr = new Config::HAProxy::Iterator($node, %rec);
114
115Returns new iterator object for traversing the tree starting from B<$node>,
116which must be a B<Config::HAProxy::Node> object. Optional B<%rec> is one of
117the keywords discussed above, in section B<DESCRIPTION>.
118
119=head1 METHODS
120
121=head2 next
122
123 $node = $itr->next;
124
125Returns next node in the traversal sequence. If all nodes were visited, returns
126B<undef>.
127
128=head1 SEE ALSO
129
130B<HAProxy::Config>, B<HAProxy::Config::Node>.
131
132=cut
133
66 134
67 135
68 136

Return to:

Send suggestions and report system problems to the System administrator.