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;
16use IPC::Cmd qw(run); 16use IPC::Cmd qw(run);
17use Carp; 17use Carp;
18 18
19our $VERSION = '1.04'; 19our $VERSION = '1.08';
20 20
21my %sections = ( 21my %sections = (
22 global => 1, 22 global => 1,
23 defaults => 1, 23 defaults => 1,
24 frontend => 1, 24 frontend => 1,
25 backend => 1, 25 backend => 1,
26 resolvers => 1
26); 27);
27 28
28sub new { 29sub new {
@@ -88,6 +89,16 @@ sub parse {
88 return $self; 89 return $self;
89} 90}
90 91
92sub declare_section {
93 my ($class, $name) = @_;
94 $sections{$name} = 1;
95}
96
97sub undeclare_section {
98 my ($class, $name) = @_;
99 $sections{$name} = 0;
100}
101
91sub reset { 102sub reset {
92 my $self = shift; 103 my $self = shift;
93 $self->{_stack} = [ new Config::HAProxy::Node::Root() ]; 104 $self->{_stack} = [ new Config::HAProxy::Node::Root() ];
@@ -344,7 +355,9 @@ Represents a simple statement.
344 355
345A container, representing a C<compound statement>, i.e. a statement that 356A container, representing a C<compound statement>, i.e. a statement that
346contains multiple sub-statements. Compound statements are: B<global>, 357contains multiple sub-statements. Compound statements are: B<global>,
347B<defaults>, B<frontend>, and B<backend>. 358B<defaults>, B<frontend>, B<backend>, and B<resolvers>. The list of
359compound statements may be modified using the B<declare_section> and
360B<undeclare_section> class methods (see below).
348 361
349=back 362=back
350 363
@@ -369,7 +382,17 @@ Additionally, section nodes provide methods for accessing their subtrees.
369 382
370For a detailed description of the node class and its methods, please refer to 383For a detailed description of the node class and its methods, please refer to
371B<Config::HAProxy::Node>. 384B<Config::HAProxy::Node>.
372 385
386=head1 CLASS METHODS
387
388 $cfg = Config::HAProxy::declare_section($name)
389
390Declares B<$name> as a top-level section.
391
392 $cfg = Config::HAProxy::undeclare_section($name)
393
394Cancels declaration of B<$name> as a top-level section.
395
373=head1 CONSTRUCTOR 396=head1 CONSTRUCTOR
374 397
375 $cfg = new Config::HAProxy($filename); 398 $cfg = new Config::HAProxy($filename);

Return to:

Send suggestions and report system problems to the System administrator.