summaryrefslogtreecommitdiffabout
path: root/lib/Config/HAProxy/Node.pm
Side-by-side diff
Diffstat (limited to 'lib/Config/HAProxy/Node.pm') (more/less context) (ignore whitespace changes)
-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 }
sub is_comment { 0 }
1;
+__END__
+
+=head1 NAME
+
+Config::HAProxy::Node - Abstract HAProxy configuration node
+
+=head1 DESCRIPTION
+
+The class B<Config::HAProxy::Node> represents an abstract node in the
+HAProxy configuration parse tree. It serves as a base class for classes
+representing configuration tree, section, simple statement, comment and
+empty line.
+
+=head1 CONSTRUCTOR
+
+ $obj = new Config::HAProxy::Node(%args);
+
+Returns new object. B<%args> can contain the following keys:
+
+=over 4
+
+=item B<kw>
+
+Configuration keyword (string),
+
+=item B<argv>
+
+Reference to the list of arguments.
+
+=item B<orig>
+
+Original text as read from the configuration file.
+
+=item B<locus>
+
+Locus (a B<Text::Locus> object) where this statement occurred.
+
+=item B<parent>
+
+Parent node.
+
+=back
+
+=head1 METHODS
+
+=head2 B<kw>, B<argv>, B<orig>, B<locus>, B<parent>
+
+These methods return the corresponding field of the node. When called
+with an argument, they set the field prior to returning it. The B<argv>
+method returns array of strings and takes as its argument a reference to
+the array of strings:
+
+ @a = $node->argv;
+
+ $node->argv([@a]);
+
+=head2 index
+
+Index (0-based) of this node in the parent node.
+
+=head2 arg
+
+ $a = $node->arg($n)
+
+Returns the B<$n>th argument (0-based) from the argument list.
+
+=head2 drop
+
+ $node->drop;
+
+Removes this node and destroys it.
+
+=head2 iterator
+
+ $itr = $node->iterator(@args);
+
+Returns the iterator for this node. See B<Config::HAProxy::Iterator> for
+a detailed discussion.
+
+=head2 depth
+
+ $n = $node->depth;
+
+Returns the depth of this node in the configuration tree. Depth is the
+number of parent nodes between the root of tree and this node. Top-level
+nodes have depth 0.
+
+=head2 root
+
+ $root_node = $node->root;
+
+Returns the root node of the parse tree this node belongs to.
+
+=head2 as_string
+
+ $s = $node->as_string;
+
+Returns canonical string representation of this node. The canonical
+representation consists of the keyword followed by arguments delimited
+with horizontal space characters.
+
+=head1 ABSTRACT METHODS
+
+Derived classes must overload at least one of the following methods:
+
+=head2 is_root
+
+True if the node is a root node, false otherwise.
+
+=head2 is_section
+
+True if the node represents a section (i.e. contains subnodes).
+
+=head2 is_statement
+
+True if the node is a simple statement.
+
+=head2 is_empty
+
+True if the node represents an empty line.
+
+=head2 is_comment
+
+True if the node represents a comment.
+
+=head1 SEE ALSO
+
+B<Config::HAProxy::Node::Comment>,
+B<Config::HAProxy::Node::Empty>,
+B<Config::HAProxy::Node::Root>,
+B<Config::HAProxy::Node::Section>,
+B<Config::HAProxy::Node::Statement>,
+B<Config::HAProxy::Iterator>,
+B<Config::HAProxy>,
+B<Text::Locus>.
+
+=cut

Return to:

Send suggestions and report system problems to the System administrator.