summaryrefslogtreecommitdiff
path: root/lib/Config/HAProxy.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Config/HAProxy.pm')
-rw-r--r--lib/Config/HAProxy.pm29
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/Config/HAProxy.pm b/lib/Config/HAProxy.pm
index 175e402..f220051 100644
--- a/lib/Config/HAProxy.pm
+++ b/lib/Config/HAProxy.pm
@@ -16,13 +16,14 @@ use File::Spec;
use IPC::Cmd qw(run);
use Carp;
-our $VERSION = '1.04';
+our $VERSION = '1.08';
my %sections = (
global => 1,
defaults => 1,
frontend => 1,
backend => 1,
+ resolvers => 1
);
sub new {
@@ -88,6 +89,16 @@ sub parse {
return $self;
}
+sub declare_section {
+ my ($class, $name) = @_;
+ $sections{$name} = 1;
+}
+
+sub undeclare_section {
+ my ($class, $name) = @_;
+ $sections{$name} = 0;
+}
+
sub reset {
my $self = shift;
$self->{_stack} = [ new Config::HAProxy::Node::Root() ];
@@ -344,7 +355,9 @@ Represents a simple statement.
A container, representing a C<compound statement>, i.e. a statement that
contains multiple sub-statements. Compound statements are: B<global>,
-B<defaults>, B<frontend>, and B<backend>.
+B<defaults>, B<frontend>, B<backend>, and B<resolvers>. The list of
+compound statements may be modified using the B<declare_section> and
+B<undeclare_section> class methods (see below).
=back
@@ -369,7 +382,17 @@ Additionally, section nodes provide methods for accessing their subtrees.
For a detailed description of the node class and its methods, please refer to
B<Config::HAProxy::Node>.
-
+
+=head1 CLASS METHODS
+
+ $cfg = Config::HAProxy::declare_section($name)
+
+Declares B<$name> as a top-level section.
+
+ $cfg = Config::HAProxy::undeclare_section($name)
+
+Cancels declaration of B<$name> as a top-level section.
+
=head1 CONSTRUCTOR
$cfg = new Config::HAProxy($filename);

Return to:

Send suggestions and report system problems to the System administrator.