summaryrefslogtreecommitdiff
path: root/lib/Config/HAProxy/Node
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Config/HAProxy/Node')
-rw-r--r--lib/Config/HAProxy/Node/Comment.pm31
-rw-r--r--lib/Config/HAProxy/Node/Empty.pm29
-rw-r--r--lib/Config/HAProxy/Node/Root.pm52
-rw-r--r--lib/Config/HAProxy/Node/Section.pm153
-rw-r--r--lib/Config/HAProxy/Node/Statement.pm45
5 files changed, 308 insertions, 2 deletions
diff --git a/lib/Config/HAProxy/Node/Comment.pm b/lib/Config/HAProxy/Node/Comment.pm
index 5d7ef88..17a513b 100644
--- a/lib/Config/HAProxy/Node/Comment.pm
+++ b/lib/Config/HAProxy/Node/Comment.pm
@@ -1,6 +1,37 @@
1package Config::HAProxy::Node::Comment; 1package Config::HAProxy::Node::Comment;
2use parent 'Config::HAProxy::Node'; 2use parent 'Config::HAProxy::Node';
3 3
4=head1 NAME
5
6Config::HAProxy::Node::Comment - comment node in HAProxy configuration
7
8=head1 DESCRIPTION
9
10Objects of this class represent comments in HAProxy configuration file.
11
12=head1 METHODS
13
14=head2 is_comment
15
16Returns true.
17
18=head2 orig
19
20Returns original line as it appeared in the configuration file.
21
22=head2 locus
23
24Returns the location of this statement in the configuration file (the
25B<Text::Locus> object).
26
27=head1 SEE ALSO
28
29B<Config::HAProxy::Node>, B<Text::Locus>.
30
31=cut
32
4sub is_comment { 1 } 33sub is_comment { 1 }
5 34
61; 351;
36
37
diff --git a/lib/Config/HAProxy/Node/Empty.pm b/lib/Config/HAProxy/Node/Empty.pm
index bee0f2e..19ce5da 100644
--- a/lib/Config/HAProxy/Node/Empty.pm
+++ b/lib/Config/HAProxy/Node/Empty.pm
@@ -1,6 +1,35 @@
1package Config::HAProxy::Node::Empty; 1package Config::HAProxy::Node::Empty;
2use parent 'Config::HAProxy::Node'; 2use parent 'Config::HAProxy::Node';
3 3
4=head1 NAME
5
6Config::HAProxy::Node::Empty - empty HAProxy configuration node
7
8=head1 DESCRIPTION
9
10Objects of this class represent empty lines in HAProxy configuration file.
11
12=head1 METHODS
13
14=head2 is_empty
15
16Always true.
17
18=head2 orig
19
20Returns original line as it appeared in the configuration file.
21
22=head2 locus
23
24Returns the location of this statement in the configuration file (the
25B<Text::Locus> object).
26
27=head1 SEE ALSO
28
29B<Config::HAProxy::Node>, B<Text::Locus>.
30
31=cut
32
4sub is_empty { 1 } 33sub is_empty { 1 }
5 34
61; 351;
diff --git a/lib/Config/HAProxy/Node/Root.pm b/lib/Config/HAProxy/Node/Root.pm
index 656bb9f..ca6e575 100644
--- a/lib/Config/HAProxy/Node/Root.pm
+++ b/lib/Config/HAProxy/Node/Root.pm
@@ -4,6 +4,19 @@ use warnings;
4use parent 'Config::HAProxy::Node::Section'; 4use parent 'Config::HAProxy::Node::Section';
5use Carp; 5use Carp;
6 6
7=head1 NAME
8
9Config::HAProxy::Node::Root - root node of HAProxy configuration parse tree
10
11=head1 DESCRIPTION
12
13Objects of this class represent the topmost node in HAProxy configuration tree.
14Each parse tree contains exactly one object of this class. This node can be
15reached from every node in the tree by following its B<parent> attribute
16and is returned by the B<tree> method of B<Config::HAProxy> class.
17
18=cut
19
7sub new { 20sub new {
8 my $class = shift; 21 my $class = shift;
9 my $self = $class->SUPER::new(@_); 22 my $self = $class->SUPER::new(@_);
@@ -11,21 +24,58 @@ sub new {
11 return $self; 24 return $self;
12} 25}
13 26
27=head1 METHODS
28
29=head2 is_root
30
31Always true.
32
33=head2 is_dirty
34
35 $bool = $node->is_dirty;
36
37Returns true if the tree is C<dirty>, i.e. it was modified since it has been
38created from the disk configuration file.
39
40=cut
41
14sub is_dirty { 42sub is_dirty {
15 my $self = shift; 43 my $self = shift;
16 return $self->{dirty} 44 return $self->{dirty}
17} 45}
18 46
47=head2 mark_dirty
48
49 $node->mark_dirty;
50
51Sets the C<dirty> attribute.
52
53=cut
54
19sub mark_dirty { 55sub mark_dirty {
20 my $self = shift; 56 my $self = shift;
21 $self->{dirty} = 1; 57 $self->{dirty} = 1;
22} 58}
23 59
60=head2 clear_dirty
61
62 $node->clear_dirty;
63
64Clears the C<dirty> attribute.
65
66=cut
67
24sub clear_dirty { 68sub clear_dirty {
25 my $self = shift; 69 my $self = shift;
26 $self->{dirty} = 0; 70 $self->{dirty} = 0;
27} 71}
28 72
73=head1 SEE ALSO
74
75B<Config::HAProxy::Node>.
76
77=cut
78
291; 791;
30 80
31 81
diff --git a/lib/Config/HAProxy/Node/Section.pm b/lib/Config/HAProxy/Node/Section.pm
index c332155..3ef1cf0 100644
--- a/lib/Config/HAProxy/Node/Section.pm
+++ b/lib/Config/HAProxy/Node/Section.pm
@@ -4,6 +4,18 @@ use warnings;
4use parent 'Config::HAProxy::Node'; 4use parent 'Config::HAProxy::Node';
5use Carp; 5use Carp;
6 6
7=head1 NAME
8
9Config::HAProxy::Node::Section - HAProxy configuration section
10
11=head1 DESCRIPTION
12
13Objects of this class represent a C<section> in the HAProxy configuration file.
14A section is a statement that can contain sub-statements. The following
15statements form sections: B<global>, B<defaults>, B<frontend>, and B<backend>.
16
17=cut
18
7sub new { 19sub new {
8 my $class = shift; 20 my $class = shift;
9 my $self = $class->SUPER::new(@_); 21 my $self = $class->SUPER::new(@_);
@@ -11,8 +23,51 @@ sub new {
11 return $self; 23 return $self;
12} 24}
13 25
26=head1 ATTRIBUTES
27
28=head2 is_section
29
30Always true.
31
32=cut
33
14sub is_section { 1 } 34sub is_section { 1 }
15 35
36=head1 METHODS
37
38=head2 kw
39
40Returns the configuration keyword.
41
42=head2 argv
43
44Returns the list of arguments to the configuration keyword.
45
46=head2 arg
47