diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-07-08 22:16:49 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-07-08 22:16:49 +0300 |
commit | 69ff9c1766ed89edf0ffdb63bf487396b6bd081b (patch) | |
tree | ef644a810f50d81d3b4e47d7cdbf64df976d8be6 /lib/Config/HAProxy/Iterator.pm | |
parent | 32b6c6394dc6a789826bd51575d9703bb4097f70 (diff) | |
download | config-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.pm | 68 |
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 | ||
65 | 1; | 65 | 1; |
66 | __END__ | ||
67 | |||
68 | =head1 NAME | ||
69 | |||
70 | Config::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 | |||
82 | The iterator object provides a method for iterating over all nodes in the | ||
83 | HAProxy parse tree. The object is returned by the B<iterator> method of | ||
84 | B<Config::HAProxy> and B<Config::HAProxy::Node> objects. The method takes | ||
85 | as optional argument the keyword specifying the order in which the tree nodes | ||
86 | should be traversed. This keyword can be one of the following: | ||
87 | |||
88 | =over 4 | ||
89 | |||
90 | =item B<recursive =E<gt> 0> | ||
91 | |||
92 | No recursion. The traversal will not descend into section nodes. This is the | ||
93 | default. | ||
94 | |||
95 | =item B<inorder =E<gt> 1> | ||
96 | |||
97 | The nodes will be traversed in the inorder manner, i.e. the section node | ||
98 | will be visited first, and all its sub-nodes after it. | ||
99 | |||
100 | =item B<postorder =E<gt> 1> | ||
101 | |||
102 | The nodes will be traversed in the postorder manner, i.e. for each section | ||
103 | node, its sub-nodes will be visited first, and the node itself afterward. | ||
104 | |||
105 | =back | ||
106 | |||
107 | =head1 CONSTRUCTOR | ||
108 | |||
109 | Note: This section is informative. You never need to create | ||
110 | B<Config::HAProxy::Iterator> objects explicitly. Please use the B<iterator> | ||
111 | method of B<Config::HAProxy> or B<Config::HAProxy::Node> class objects. | ||
112 | |||
113 | $itr = new Config::HAProxy::Iterator($node, %rec); | ||
114 | |||
115 | Returns new iterator object for traversing the tree starting from B<$node>, | ||
116 | which must be a B<Config::HAProxy::Node> object. Optional B<%rec> is one of | ||
117 | the keywords discussed above, in section B<DESCRIPTION>. | ||
118 | |||
119 | =head1 METHODS | ||
120 | |||
121 | =head2 next | ||
122 | |||
123 | $node = $itr->next; | ||
124 | |||
125 | Returns next node in the traversal sequence. If all nodes were visited, returns | ||
126 | B<undef>. | ||
127 | |||
128 | =head1 SEE ALSO | ||
129 | |||
130 | B<HAProxy::Config>, B<HAProxy::Config::Node>. | ||
131 | |||
132 | =cut | ||
133 | |||
66 | 134 | ||
67 | 135 | ||
68 | 136 | ||