diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-07-12 09:09:03 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-07-12 09:09:03 +0300 |
commit | edfeb103b85e10aa9e6825d3b92c5888fb4dea94 (patch) | |
tree | a464544110c01c65098a282c459e54afdb41c455 | |
parent | 77946164120de0a135035621762779bfa50e82d0 (diff) | |
download | config-haproxy-edfeb103b85e10aa9e6825d3b92c5888fb4dea94.tar.gz config-haproxy-edfeb103b85e10aa9e6825d3b92c5888fb4dea94.tar.bz2 |
Drop dependency on autodiev1.01
* Changes: Update
* lib/Config/HAProxy.pm: Improve description of the write method.
* t/format.t: Pass string ref to write. Don't use autodie.
* t/select.t: Don't use autodie.
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | lib/Config/HAProxy.pm | 3 | ||||
-rw-r--r-- | t/format.t | 17 | ||||
-rw-r--r-- | t/select.t | 1 |
4 files changed, 10 insertions, 15 deletions
@@ -1,5 +1,9 @@ Revision history for Perl extension Config::HAProxy. +1.01 Thu Jul 12 09:04:28 2018 + - set minimal required Perl version + - drop dependency on autodie + 1.00 Sun Jul 8 19:57:57 2018 - original revision 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. Saves the parse tree in the configuration file. =head2 write $cfg->write($file, %hash); -Writes configuration to the named file or file handle. If B<$file> is the +Writes configuration to the named file or file handle. First argument +can be a file name, file handle or a string reference. If it is the only argument, the original indentation is preserved. Otherwise, if B<%hash> controls the indentation of the output. It must contain at least the B<indent> key, which specifies the amount of indentation per nesting level. If B<tabstop> key is also present, its value must be a reference to the list of tabstop columns. For each statement with arguments, this array is consulted to determine the column number for each subsequent argument. @@ -1,25 +1,22 @@ # -*- perl -*- use lib qw(t lib); use strict; use warnings; use Test::More; -use autodie; BEGIN { plan tests => 6; use_ok('Test::HAProxy'); } my $hp = new Test::HAProxy; isa_ok($hp,'Test::HAProxy'); my $s; -open(my $fh, '>', \$s); -$hp->write($fh); -close $fh; +$hp->write(\$s); is($s, q{global # comment log /dev/log daemon user haproxy group haproxy @@ -30,15 +27,13 @@ frontend in mode http bind :::80 v4v6 backend out server localhost http://127.0.0.1 }, 'default write'); -open($fh, '>', \$s); -$hp->write($fh, indent => 2); -close $fh; +$hp->write(\$s, indent => 2); is($s, q{global # comment log /dev/log daemon user haproxy group haproxy @@ -49,15 +44,13 @@ frontend in mode http bind :::80 v4v6 backend out server localhost http://127.0.0.1 }, 'reindent'); -open($fh, '>', \$s); -$hp->write($fh, indent => 2, reindent_comments => 1); -close $fh; +$hp->write(\$s, indent => 2, reindent_comments => 1); is($s, q{global # comment log /dev/log daemon user haproxy group haproxy @@ -68,15 +61,13 @@ frontend in mode http bind :::80 v4v6 backend out server localhost http://127.0.0.1 }, 'reindent comments'); -open($fh, '>', \$s); -$hp->write($fh, indent => 4, tabstop => [ 10, 24 ]); -close $fh; +$hp->write(\$s, indent => 4, tabstop => [ 10, 24 ]); is($s, q{global # comment log /dev/log daemon user haproxy group haproxy @@ -1,12 +1,11 @@ # -*- perl -*- use lib qw(t lib); use strict; use warnings; use Test::More; -use autodie; BEGIN { plan tests => 4; use_ok('Test::HAProxy'); } |