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) (side-by-side diff)
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',
'File::Temp' => '0.22',
- 'Text::Locus' => '1.01'
+ 'Text::Locus' => '1.01',
+ 'Config::AST' => 0
},
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;
use warnings;
-use parent 'Config::Tree';
+use parent 'Config::AST';
use Carp;
@@ -25,6 +25,6 @@ sub new {
- unless ($_{parameters}) {
+ unless ($_{lexicon}) {
my $subs = Class::Inspector->subclasses(__PACKAGE__);
if ($subs) {
- $_{parameters} = {};
+ $_{lexicon} = {};
foreach my $c (@$subs) {
@@ -32,3 +32,3 @@ sub new {
if (my $s = loadsynt($c)) {
- $_{parameters} = { %{$_{parameters}}, %$s };
+ $_{lexicon} = { %{$_{lexicon}}, %$s };
}
@@ -36,3 +36,3 @@ sub new {
}
- delete $_{parameters} unless keys %{$_{parameters}};
+ delete $_{lexicon} unless keys %{$_{lexicon}};
}
@@ -73,3 +73,3 @@ sub loadsynt {
line => $line,
- parameters => { '*' => '*' })
+ lexicon => { '*' => '*' })
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 {
$self->add_node(\@path,
- new Config::Tree::Node::Section(locus => $locus));
+ new Config::AST::Node::Section(locus => $locus));
}
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;
-use Config::Tree qw(:sort);
+use Config::AST qw(:sort);
use parent 'Config::Parser::Ini';
@@ -66,13 +66,3 @@ sub canonical {
my $self = shift;
- local %_ = @_;
- carp "unknown parameters: " . join(', ', keys(%_)) if (keys(%_));
- return join $_{delim} // " ", map {
- join('.', @{$_->[0]})
- . "="
- . Data::Dumper->new([$_->[1]->value])
- ->Useqq(1)
- ->Terse(1)
- ->Indent(0)
- ->Dump
- } $self->flatten(sort => SORT_PATH);
+ return $self->SUPER::canonical(delim => ' ');
}

Return to:

Send suggestions and report system problems to the System administrator.