Config::HAProxy::Node::Section - HAProxy configuration section
Objects of this class represent a section in the HAProxy configuration file. A section is a statement that can contain sub-statements. The following statements form sections: global, defaults, frontend, and backend.
section
Always true.
Returns the configuration keyword.
Returns the list of arguments to the configuration keyword.
$s = $node->arg($n)
Returns the $nth argument.
Returns original line as it appeared in the configuration file.
Returns the location of this statement in the configuration file (the Text::Locus object).
$section->append_node(@nodes);
Takes a list of objects of Config::HAProxy::Node derived classes as arguments. Adds these objects after the last node in the subtree in this section.
$section->append_node_nonempty(@nodes);
Same as append_node, but adds new nodes after the last non-empty node in the subtree.
$section->insert_node($idx, @nodes);
Inserts @nodes after subnode in position $idx (0-based).
$section->delete_node($i);
Deletes $ith subnode from the $section.
@nodes = $section->tree;
Returns subnodes as a list of Config::HAProxy::Node derived objects.
$node = $section->tree($i);
Returns $ith subnode from the $section.
$bool = $section->ends_in_empty
Returns true if the last node in the list of sub-nodes in $section is an empty node.
@nodes = $section->select(%cond);
Returns nodes from $section that match conditions in %cond. Valid conditions are:
Node matches if its keyword (kw) equals $s.
Node mathches if its $nth argument equals $s.
Node matches if it is (or is not, if $bool is false) a section.
Node matches if it is (not) a simple statement.
Node matches if it is (not) a comment.
Multiple conditions are checked in the order of their appearance in the argument list and are joined by the short-circuit logical and.
and
For example, to return all frontend statements:
@fe = $section->select(name => 'frontend');
To return the frontend named in:
in
($fe) = $section->select( name => 'frontend', arg => { n => 0, v => 'in' } );
Config::HAProxy::Node, Config::HAProxy, Text::Locus.
To install Config::HAProxy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::HAProxy
CPAN shell
perl -MCPAN -e shell install Config::HAProxy
For more information on module installation, please visit the detailed CPAN module installation guide.