summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes4
-rw-r--r--lib/Config/HAProxy.pm3
-rw-r--r--t/format.t17
-rw-r--r--t/select.t1
4 files changed, 10 insertions, 15 deletions
diff --git a/Changes b/Changes
index f67f71f..2fe0426 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
1Revision history for Perl extension Config::HAProxy. 1Revision history for Perl extension Config::HAProxy.
2 2
31.01 Thu Jul 12 09:04:28 2018
4 - set minimal required Perl version
5 - drop dependency on autodie
6
31.00 Sun Jul 8 19:57:57 2018 71.00 Sun Jul 8 19:57:57 2018
4 - original revision 8 - original revision
5 9
diff --git a/lib/Config/HAProxy.pm b/lib/Config/HAProxy.pm
index 74eafa4..9a8d666 100644
--- a/lib/Config/HAProxy.pm
+++ b/lib/Config/HAProxy.pm
@@ -368,13 +368,14 @@ Returns the last node in the tree.
368Saves the parse tree in the configuration file. 368Saves the parse tree in the configuration file.
369 369
370=head2 write 370=head2 write
371 371
372 $cfg->write($file, %hash); 372 $cfg->write($file, %hash);
373 373
374Writes configuration to the named file or file handle. If B<$file> is the 374Writes configuration to the named file or file handle. First argument
375can be a file name, file handle or a string reference. If it is the
375only argument, the original indentation is preserved. Otherwise, if 376only argument, the original indentation is preserved. Otherwise, if
376B<%hash> controls the indentation of the output. It must contain at least 377B<%hash> controls the indentation of the output. It must contain at least
377the B<indent> key, which specifies the amount of indentation per nesting 378the B<indent> key, which specifies the amount of indentation per nesting
378level. If B<tabstop> key is also present, its value must be a reference to 379level. If B<tabstop> key is also present, its value must be a reference to
379the list of tabstop columns. For each statement with arguments, this array 380the list of tabstop columns. For each statement with arguments, this array
380is consulted to determine the column number for each subsequent argument. 381is consulted to determine the column number for each subsequent argument.
diff --git a/t/format.t b/t/format.t
index 06b9884..2d124fc 100644
--- a/t/format.t
+++ b/t/format.t
@@ -1,25 +1,22 @@
1# -*- perl -*- 1# -*- perl -*-
2use lib qw(t lib); 2use lib qw(t lib);
3use strict; 3use strict;
4use warnings; 4use warnings;
5use Test::More; 5use Test::More;
6use autodie;
7 6
8BEGIN { 7BEGIN {
9 plan tests => 6; 8 plan tests => 6;
10 use_ok('Test::HAProxy'); 9 use_ok('Test::HAProxy');
11} 10}
12 11
13my $hp = new Test::HAProxy; 12my $hp = new Test::HAProxy;
14isa_ok($hp,'Test::HAProxy'); 13isa_ok($hp,'Test::HAProxy');
15 14
16my $s; 15my $s;
17open(my $fh, '>', \$s); 16$hp->write(\$s);
18$hp->write($fh);
19close $fh;
20 17
21is($s, q{global 18is($s, q{global
22# comment 19# comment
23 log /dev/log daemon 20 log /dev/log daemon
24 user haproxy 21 user haproxy
25 group haproxy 22 group haproxy
@@ -30,15 +27,13 @@ frontend in
30 mode http 27 mode http
31 bind :::80 v4v6 28 bind :::80 v4v6
32backend out 29backend out
33 server localhost http://127.0.0.1 30 server localhost http://127.0.0.1
34}, 'default write'); 31}, 'default write');
35 32
36open($fh, '>', \$s); 33$hp->write(\$s, indent => 2);
37$hp->write($fh, indent => 2);
38close $fh;
39 34
40is($s, q{global 35is($s, q{global
41# comment 36# comment
42 log /dev/log daemon 37 log /dev/log daemon
43 user haproxy 38 user haproxy
44 group haproxy 39 group haproxy
@@ -49,15 +44,13 @@ frontend in
49 mode http 44 mode http
50 bind :::80 v4v6 45 bind :::80 v4v6
51backend out 46backend out
52 server localhost http://127.0.0.1 47 server localhost http://127.0.0.1
53}, 'reindent'); 48}, 'reindent');
54 49
55open($fh, '>', \$s); 50$hp->write(\$s, indent => 2, reindent_comments => 1);
56$hp->write($fh, indent => 2, reindent_comments => 1);
57close $fh;
58 51
59is($s, q{global 52is($s, q{global
60 # comment 53 # comment
61 log /dev/log daemon 54 log /dev/log daemon
62 user haproxy 55 user haproxy
63 group haproxy 56 group haproxy
@@ -68,15 +61,13 @@ frontend in
68 mode http 61 mode http
69 bind :::80 v4v6 62 bind :::80 v4v6
70backend out 63backend out
71 server localhost http://127.0.0.1 64 server localhost http://127.0.0.1
72}, 'reindent comments'); 65}, 'reindent comments');
73 66
74open($fh, '>', \$s); 67$hp->write(\$s, indent => 4, tabstop => [ 10, 24 ]);
75$hp->write($fh, indent => 4, tabstop => [ 10, 24 ]);
76close $fh;
77 68
78is($s, q{global 69is($s, q{global
79# comment 70# comment
80 log /dev/log daemon 71 log /dev/log daemon
81 user haproxy 72 user haproxy
82 group haproxy 73 group haproxy
diff --git a/t/select.t b/t/select.t
index 0be1c9c..1930ff6 100644
--- a/t/select.t
+++ b/t/select.t
@@ -1,12 +1,11 @@
1# -*- perl -*- 1# -*- perl -*-
2use lib qw(t lib); 2use lib qw(t lib);
3use strict; 3use strict;
4use warnings; 4use warnings;
5use Test::More; 5use Test::More;
6use autodie;
7 6
8BEGIN { 7BEGIN {
9 plan tests => 4; 8 plan tests => 4;
10 use_ok('Test::HAProxy'); 9 use_ok('Test::HAProxy');
11} 10}
12 11

Return to:

Send suggestions and report system problems to the System administrator.