diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2018-07-09 22:39:25 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2018-07-09 22:39:25 +0200 |
commit | db3dbb29a2ad58ef2f43d3f9d250e7f90aeaf278 (patch) | |
tree | fa84a90f7f6b304b083c746aeb09a9cc853c3035 | |
parent | eda00b0eaa069d5631efec255ef162b695d73d33 (diff) | |
download | config-parser-db3dbb29a2ad58ef2f43d3f9d250e7f90aeaf278.tar.gz config-parser-db3dbb29a2ad58ef2f43d3f9d250e7f90aeaf278.tar.bz2 |
Use Text::Locus
-rw-r--r-- | Makefile.PL | 1 | ||||
-rw-r--r-- | lib/Config/Parser.pm | 2 | ||||
-rw-r--r-- | lib/Config/Parser/Ini.pm | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/Makefile.PL b/Makefile.PL index 8ff01ae..bc0ba75 100644 --- a/Makefile.PL +++ b/Makefile.PL | |||
@@ -13,12 +13,13 @@ WriteMakefile(NAME => 'Config::Parser', | |||
13 | PREREQ_PM => { | 13 | PREREQ_PM => { |
14 | 'Carp' => 0, | 14 | 'Carp' => 0, |
15 | 'Text::ParseWords' => 0, | 15 | 'Text::ParseWords' => 0, |
16 | 'Class::Inspector' => 0, | 16 | 'Class::Inspector' => 0, |
17 | 'Data::Dumper' => '2.135_06', | 17 | 'Data::Dumper' => '2.135_06', |
18 | 'File::Temp' => '0.22', | 18 | 'File::Temp' => '0.22', |
19 | 'Text::Locus' => '1.01' | ||
19 | }, | 20 | }, |
20 | META_MERGE => { | 21 | META_MERGE => { |
21 | 'meta-spec' => { version => 2 }, | 22 | 'meta-spec' => { version => 2 }, |
22 | resources => { | 23 | resources => { |
23 | repository => { | 24 | repository => { |
24 | type => 'git', | 25 | type => 'git', |
diff --git a/lib/Config/Parser.pm b/lib/Config/Parser.pm index c0a2179..93b23fc 100644 --- a/lib/Config/Parser.pm +++ b/lib/Config/Parser.pm | |||
@@ -101,13 +101,13 @@ sub loadsynt { | |||
101 | } | 101 | } |
102 | 102 | ||
103 | while (($val = shift @words) | 103 | while (($val = shift @words) |
104 | && $val =~ /^:(?<kw>.+?)(?:\s*=\s*(?<val>.*))?$/) { | 104 | && $val =~ /^:(?<kw>.+?)(?:\s*=\s*(?<val>.*))?$/) { |
105 | $ret->{$+{kw}} = $+{val} // 1; | 105 | $ret->{$+{kw}} = $+{val} // 1; |
106 | } | 106 | } |
107 | $ret->{default} = $val if $val; | 107 | $ret->{default} = $val if defined($val); |
108 | ($name, $ret); | 108 | ($name, $ret); |
109 | } | 109 | } |
110 | })->{section}; | 110 | })->{section}; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/lib/Config/Parser/Ini.pm b/lib/Config/Parser/Ini.pm index b3a1ef9..3b39a16 100644 --- a/lib/Config/Parser/Ini.pm +++ b/lib/Config/Parser/Ini.pm | |||
@@ -50,13 +50,13 @@ sub _readconfig { | |||
50 | 50 | ||
51 | s/^\s+//; | 51 | s/^\s+//; |
52 | s/\s+$//; | 52 | s/\s+$//; |
53 | s/#.*//; | 53 | s/#.*//; |
54 | next if ($_ eq ""); | 54 | next if ($_ eq ""); |
55 | 55 | ||
56 | my $locus = new Config::Tree::Locus($file, $line); | 56 | my $locus = new Text::Locus($file, $line); |
57 | 57 | ||
58 | if (/^\[(.+?)\]$/) { | 58 | if (/^\[(.+?)\]$/) { |
59 | @path = parse_line('\s+', 0, $1); | 59 | @path = parse_line('\s+', 0, $1); |
60 | if (@path == 1 && $path[0] eq 'include') { | 60 | if (@path == 1 && $path[0] eq 'include') { |
61 | $include = 1; | 61 | $include = 1; |
62 | } else { | 62 | } else { |