summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2018-07-10 12:27:07 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2018-07-10 12:27:07 (GMT)
commitef4bb8963e1a89da2b62274758361617f5384ce3 (patch) (unidiff)
tree46c7d15cdf08bfd569d7ae6b2910bf361ec37a08
parentdb3dbb29a2ad58ef2f43d3f9d250e7f90aeaf278 (diff)
downloadconfig-parser-ef4bb8963e1a89da2b62274758361617f5384ce3.tar.gz
config-parser-ef4bb8963e1a89da2b62274758361617f5384ce3.tar.bz2
Switch to Config::AST
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.PL3
-rw-r--r--lib/Config/Parser.pm12
-rw-r--r--lib/Config/Parser/Ini.pm2
-rw-r--r--t/TestConfig.pm14
4 files changed, 11 insertions, 20 deletions
diff --git a/Makefile.PL b/Makefile.PL
index bc0ba75..cee8413 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -18,3 +18,4 @@ WriteMakefile(NAME => 'Config::Parser',
18 'File::Temp' => '0.22', 18 'File::Temp' => '0.22',
19 'Text::Locus' => '1.01' 19 'Text::Locus' => '1.01',
20 'Config::AST' => 0
20 }, 21 },
diff --git a/lib/Config/Parser.pm b/lib/Config/Parser.pm
index 93b23fc..ee5055b 100644
--- a/lib/Config/Parser.pm
+++ b/lib/Config/Parser.pm
@@ -3,3 +3,3 @@ use strict;
3use warnings; 3use warnings;
4use parent 'Config::Tree'; 4use parent 'Config::AST';
5use Carp; 5use Carp;
@@ -25,6 +25,6 @@ sub new {
25 25
26 unless ($_{parameters}) { 26 unless ($_{lexicon}) {
27 my $subs = Class::Inspector->subclasses(__PACKAGE__); 27 my $subs = Class::Inspector->subclasses(__PACKAGE__);
28 if ($subs) { 28 if ($subs) {
29 $_{parameters} = {}; 29 $_{lexicon} = {};
30 foreach my $c (@$subs) { 30 foreach my $c (@$subs) {
@@ -32,3 +32,3 @@ sub new {
32 if (my $s = loadsynt($c)) { 32 if (my $s = loadsynt($c)) {
33 $_{parameters} = { %{$_{parameters}}, %$s }; 33 $_{lexicon} = { %{$_{lexicon}}, %$s };
34 } 34 }
@@ -36,3 +36,3 @@ sub new {
36 } 36 }
37 delete $_{parameters} unless keys %{$_{parameters}}; 37 delete $_{lexicon} unless keys %{$_{lexicon}};
38 } 38 }
@@ -73,3 +73,3 @@ sub loadsynt {
73 line => $line, 73 line => $line,
74 parameters => { '*' => '*' }) 74 lexicon => { '*' => '*' })
75 or croak "Failed to parse template at $file:$line"; 75 or croak "Failed to parse template at $file:$line";
diff --git a/lib/Config/Parser/Ini.pm b/lib/Config/Parser/Ini.pm
index 3b39a16..0ea632c 100644
--- a/lib/Config/Parser/Ini.pm
+++ b/lib/Config/Parser/Ini.pm
@@ -64,3 +64,3 @@ sub _readconfig {
64 $self->add_node(\@path, 64 $self->add_node(\@path,
65 new Config::Tree::Node::Section(locus => $locus)); 65 new Config::AST::Node::Section(locus => $locus));
66 } 66 }
diff --git a/t/TestConfig.pm b/t/TestConfig.pm
index 886e66b..bd4f3f5 100644
--- a/t/TestConfig.pm
+++ b/t/TestConfig.pm
@@ -6,3 +6,3 @@ use Carp;
6 6
7use Config::Tree qw(:sort); 7use Config::AST qw(:sort);
8use parent 'Config::Parser::Ini'; 8use parent 'Config::Parser::Ini';
@@ -66,13 +66,3 @@ sub canonical {
66 my $self = shift; 66 my $self = shift;
67 local %_ = @_; 67 return $self->SUPER::canonical(delim => ' ');
68 carp "unknown parameters: " . join(', ', keys(%_)) if (keys(%_));
69 return join $_{delim} // " ", map {
70 join('.', @{$_->[0]})
71 . "="
72 . Data::Dumper->new([$_->[1]->value])
73 ->Useqq(1)
74 ->Terse(1)
75 ->Indent(0)
76 ->Dump
77 } $self->flatten(sort => SORT_PATH);
78} 68}

Return to:

Send suggestions and report system problems to the System administrator.