summaryrefslogtreecommitdiff
path: root/lib/Config/HAProxy/Node.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Config/HAProxy/Node.pm')
-rw-r--r--lib/Config/HAProxy/Node.pm137
1 files changed, 137 insertions, 0 deletions
diff --git a/lib/Config/HAProxy/Node.pm b/lib/Config/HAProxy/Node.pm
index be09538..8210067 100644
--- a/lib/Config/HAProxy/Node.pm
+++ b/lib/Config/HAProxy/Node.pm
@@ -97,3 +97,140 @@ sub is_empty { 0 }
97sub is_comment { 0 } 97sub is_comment { 0 }
98 98
991; 991;
100__END__
101
102=head1 NAME
103
104Config::HAProxy::Node - Abstract HAProxy configuration node
105
106=head1 DESCRIPTION
107
108The class B<Config::HAProxy::Node> represents an abstract node in the
109HAProxy configuration parse tree. It serves as a base class for classes
110representing configuration tree, section, simple statement, comment and
111empty line.
112
113=head1 CONSTRUCTOR
114
115 $obj = new Config::HAProxy::Node(%args);
116
117Returns new object. B<%args> can contain the following keys:
118
119=over 4
120
121=item B<kw>
122
123Configuration keyword (string),
124
125=item B<argv>
126
127Reference to the list of arguments.
128
129=item B<orig>
130
131Original text as read from the configuration file.
132
133=item B<locus>
134
135Locus (a B<Text::Locus> object) where this statement occurred.
136
137=item B<parent>
138
139Parent node.
140
141=back
142
143=head1 METHODS
144
145=head2 B<kw>, B<argv>, B<orig>, B<locus>, B<parent>
146
147These methods return the corresponding field of the node. When called
148with an argument, they set the field prior to returning it. The B<argv>
149method returns array of strings and takes as its argument a reference to
150the array of strings:
151
152 @a = $node->argv;
153
154 $node->argv([@a]);
155
156=head2 index
157
158Index (0-based) of this node in the parent node.
159
160=head2 arg
161
162 $a = $node->arg($n)
163
164Returns the B<$n>th argument (0-based) from the argument list.
165
166=head2 drop
167
168 $node->drop;
169
170Removes this node and destroys it.
171
172=head2 iterator
173
174 $itr = $node->iterator(@args);
175
176Returns the iterator for this node. See B<Config::HAProxy::Iterator> for
177a detailed discussion.
178
179=head2 depth
180
181 $n = $node->depth;
182
183Returns the depth of this node in the configuration tree. Depth is the
184number of parent nodes between the root of tree and this node. Top-level
185nodes have depth 0.
186
187=head2 root
188
189 $root_node = $node->root;
190
191Returns the root node of the parse tree this node belongs to.
192
193=head2 as_string
194
195 $s = $node->as_string;
196
197Returns canonical string representation of this node. The canonical
198representation consists of the keyword followed by arguments delimited
199with horizontal space characters.
200
201=head1 ABSTRACT METHODS
202
203Derived classes must overload at least one of the following methods:
204
205=head2 is_root
206
207True if the node is a root node, false otherwise.
208
209=head2 is_section
210
211True if the node represents a section (i.e. contains subnodes).
212
213=head2 is_statement
214
215True if the node is a simple statement.
216
217=head2 is_empty
218
219True if the node represents an empty line.
220
221=head2 is_comment
222
223True if the node represents a comment.
224
225=head1 SEE ALSO
226
227B<Config::HAProxy::Node::Comment>,
228B<Config::HAProxy::Node::Empty>,
229B<Config::HAProxy::Node::Root>,
230B<Config::HAProxy::Node::Section>,
231B<Config::HAProxy::Node::Statement>,
232B<Config::HAProxy::Iterator>,
233B<Config::HAProxy>,
234B<Text::Locus>.
235
236=cut

Return to:

Send suggestions and report system problems to the System administrator.