diff options
-rw-r--r-- | Changes | 8 | ||||
-rw-r--r-- | Makefile.PL | 4 | ||||
-rw-r--r-- | lib/Config/HAProxy.pm | 27 | ||||
-rw-r--r-- | lib/Config/HAProxy/Node.pm | 1 |
4 files changed, 38 insertions, 2 deletions
@@ -1,5 +1,13 @@ Revision history for Perl extension Config::HAProxy. +1.08 Thu Jun 23 15:21:17 2022 + - Handle the 'resolvers' section. + - New class methods for declaring (and undeclaring) sections. + - Fix changing the argv of a Node. + +1.06 Fri Feb 12 20:37:32 2021 + - Change bugtracker address. + 1.05 Mon May 27 13:59:57 2019 - unlink temporary file on error diff --git a/Makefile.PL b/Makefile.PL index 754d3aa..d7c08b9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -27,6 +27,10 @@ WriteMakefile( url => 'git://git.gnu.org.ua/config-haproxy.git', web => 'http://git.gnu.org.ua/cgit/config-haproxy.git/', }, + bugtracker => { + web => 'https://puszcza.gnu.org.ua/bugs/?group=config-haproxy', + mailto => 'gray+config-haproxy@gnu.org.ua' + } }, provides => Module::Metadata->provides(version => '1.4', dir => 'lib') diff --git a/lib/Config/HAProxy.pm b/lib/Config/HAProxy.pm index 35e75b9..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.05'; +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 @@ -370,6 +383,16 @@ 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); diff --git a/lib/Config/HAProxy/Node.pm b/lib/Config/HAProxy/Node.pm index 8210067..32e63c0 100644 --- a/lib/Config/HAProxy/Node.pm +++ b/lib/Config/HAProxy/Node.pm @@ -38,6 +38,7 @@ sub argv { if (my $val = shift) { croak "too many arguments" if @_; $self->{_argv} = $val; + delete $self->{_orig}; } return @{$self->{_argv}}; } |