summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Changes3
-rw-r--r--Makefile.PL2
-rw-r--r--lib/Config/Parser.pm12
-rw-r--r--lib/Config/Parser/Ini.pm13
4 files changed, 16 insertions, 14 deletions
diff --git a/Changes b/Changes
index 39c85ac..4946431 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
1Revision history for Perl extension Config::Parser 1Revision history for Perl extension Config::Parser
2 2
31.04 Thu Aug 29 08:17:52 2019
4 - use Config::AST 1.05
5
31.03 Fri Aug 23 14:44:18 2019 61.03 Fri Aug 23 14:44:18 2019
4 - implement the BOOLEAN data type 7 - implement the BOOLEAN data type
5 8
diff --git a/Makefile.PL b/Makefile.PL
index 366fee2..13a762d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -16,7 +16,7 @@ WriteMakefile(NAME => 'Config::Parser',
16 'Data::Dumper' => '2.135_06', 16 'Data::Dumper' => '2.135_06',
17 'File::Temp' => '0.22', 17 'File::Temp' => '0.22',
18 'Text::Locus' => '1.01', 18 'Text::Locus' => '1.01',
19 'Config::AST' => '1.01' 19 'Config::AST' => '1.05'
20 }, 20 },
21 META_MERGE => { 21 META_MERGE => {
22 'meta-spec' => { version => 2 }, 22 'meta-spec' => { version => 2 },
diff --git a/lib/Config/Parser.pm b/lib/Config/Parser.pm
index bd230b5..ee39c2e 100644
--- a/lib/Config/Parser.pm
+++ b/lib/Config/Parser.pm
@@ -7,7 +7,7 @@ use Cwd qw(abs_path);
7use Text::ParseWords; 7use Text::ParseWords;
8use mro; 8use mro;
9 9
10our $VERSION = "1.03"; 10our $VERSION = "1.04";
11 11
12sub new { 12sub new {
13 my $class = shift; 13 my $class = shift;
@@ -177,7 +177,7 @@ Config::Parser - base class for configuration file parsers
177 177
178B<Config::Parser> provides a framework for writing configuration file 178B<Config::Parser> provides a framework for writing configuration file
179parsers. It is an intermediate layer between the abstract syntax tree 179parsers. It is an intermediate layer between the abstract syntax tree
180(B<Config::AST>) and implementation of a parser for a particular 180(L<Config::AST>) and implementation of a parser for a particular
181configuration file format. 181configuration file format.
182 182
183It takes a I<define by example> approach. That means that the implementer 183It takes a I<define by example> approach. That means that the implementer
@@ -280,7 +280,7 @@ Valid only together with B<filename>.
280 280
281Dictionary of allowed configuration statements in the file. You will not 281Dictionary of allowed configuration statements in the file. You will not
282need this parameter. It is listed here for completeness sake. Refer to 282need this parameter. It is listed here for completeness sake. Refer to
283the B<Config::AST> constructor for details. 283the L<Config::AST> constructor for details.
284 284
285=back 285=back
286 286
@@ -302,7 +302,7 @@ source tree.
302 302
303=head1 PARSER METHODS 303=head1 PARSER METHODS
304 304
305The following two methods are derived from B<Config::AST>. They are 305The following two methods are derived from L<Config::AST>. They are
306called internally by the constructor, if the file name is supplied. 306called internally by the constructor, if the file name is supplied.
307 307
308=head2 $cfg->parse($filename, %opts) 308=head2 $cfg->parse($filename, %opts)
@@ -373,7 +373,7 @@ If the data type is omitted, no checking is performed unless specified
373otherwise by other options (see the B<:re> and B<:check> options below). 373otherwise by other options (see the B<:re> and B<:check> options below).
374 374
375Options are special names prefixed with a colon. Option names follow 375Options are special names prefixed with a colon. Option names follow
376the keywords from the B<Config::AST> keyword lexicon value. An option 376the keywords from the L<Config::AST> keyword lexicon value. An option
377can be followed by an equals sign and its value. If an option is used 377can be followed by an equals sign and its value. If an option is used
378without arguments, the value B<1> is implied. 378without arguments, the value B<1> is implied.
379 379
@@ -454,7 +454,7 @@ returns 0.
454 454
455=head1 SEE ALSO 455=head1 SEE ALSO
456 456
457B<Config::AST>(3). 457L<Config::AST>(3).
458 458
459=cut 459=cut
460 460
diff --git a/lib/Config/Parser/Ini.pm b/lib/Config/Parser/Ini.pm
index 67eaf1f..29923cf 100644
--- a/lib/Config/Parser/Ini.pm
+++ b/lib/Config/Parser/Ini.pm
@@ -62,11 +62,10 @@ sub _readconfig {
62 } else { 62 } else {
63 $include = 0; 63 $include = 0;
64 $self->add_node(\@path, 64 $self->add_node(\@path,
65 new Config::AST::Node::Section(locus => $locus)); 65 new Config::AST::Node::Section($self, locus => $locus));
66 } 66 }
67 } elsif (/([\w_-]+)\s*=\s*(.*)/) { 67 } elsif (/([\w_-]+)\s*=\s*(.*)/) {
68 my ($k, $v) = ($1, $2); 68 my ($k, $v) = ($1, $2);
69 $k = lc($k) if $self->{_ci}; #FIXME:private member
70 69
71 if ($include) { 70 if ($include) {
72 if ($k eq 'path') { 71 if ($k eq 'path') {
@@ -148,7 +147,7 @@ fragment:
148 147
149On success, this returns a valid B<Config::Parser::Ini> object. On error, 148On success, this returns a valid B<Config::Parser::Ini> object. On error,
150the diagnostic message is issued using the B<error> method (see the description 149the diagnostic message is issued using the B<error> method (see the description
151of the method in B<Config::AST>(3)) and the module croaks. 150of the method in L<Config::AST>(3)) and the module croaks.
152 151
153This usage, although simple, has one major drawback - no checking is performed 152This usage, although simple, has one major drawback - no checking is performed
154on the input file, except for the syntax check. To fix this, you can supply 153on the input file, except for the syntax check. To fix this, you can supply
@@ -200,7 +199,7 @@ additional validation for the configuration statements using the
200B<:check> option. The argument to this option is the name of a 199B<:check> option. The argument to this option is the name of a
201method which will be invoked after parsing the statement in order 200method which will be invoked after parsing the statement in order
202to verify its value. It is described in detail below (see the section 201to verify its value. It is described in detail below (see the section
203B<SYNTAX DEFINITION> in the documentation of B<Config::Parser>). 202B<SYNTAX DEFINITION> in the documentation of L<Config::Parser>).
204For example, if you wish to ensure that the value of the C<root> setting 203For example, if you wish to ensure that the value of the C<root> setting
205in C<core> section points to an existing directory, you would do: 204in C<core> section points to an existing directory, you would do:
206 205
@@ -255,17 +254,17 @@ created by using B<open> on the supplied filename.
255 254
256Dictionary of allowed configuration statements in the file. You will not 255Dictionary of allowed configuration statements in the file. You will not
257need this parameter. It is listed here for completeness sake. Refer to 256need this parameter. It is listed here for completeness sake. Refer to
258the B<Config::AST> constructor for details. 257the L<Config::AST> constructor for details.
259 258
260=back 259=back
261 260
262=head1 METHODS 261=head1 METHODS
263 262
264All methods are inherited from B<Config::Parser>. Please see its 263All methods are inherited from L<Config::Parser>. Please see its
265documentation for details. 264documentation for details.
266 265
267=head1 SEE ALSO 266=head1 SEE ALSO
268 267
269B<Config::Parser>(3), B<Config::AST>(3). 268L<Config::Parser>(3), L<Config::AST>(3).
270 269
271=cut 270=cut

Return to:

Send suggestions and report system problems to the System administrator.