aboutsummaryrefslogtreecommitdiff
path: root/lib/Config/Parser
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-08-29 08:19:31 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-08-29 08:22:18 +0300
commit719e57aabc1c65cb5b9feaf1733859f0e8d4931f (patch)
tree88166e86c5b9bc4c536536bb7783af6580961cda /lib/Config/Parser
parentd69ba51bb8498146d07a08031de3685e6cda0768 (diff)
downloadconfig-parser-719e57aabc1c65cb5b9feaf1733859f0e8d4931f.tar.gz
config-parser-719e57aabc1c65cb5b9feaf1733859f0e8d4931f.tar.bz2
Update for Config::AST 1.05v1.04
* Changes: Update. * Makefile.PL: Require Config::AST 1.05 * lib/Config/Parser.pm: Use L<> for cross-references. * lib/Config/Parser/Ini.pm (_readconfig): Fix creation of section nodes. Remove access to the private class member
Diffstat (limited to 'lib/Config/Parser')
-rw-r--r--lib/Config/Parser/Ini.pm13
1 files changed, 6 insertions, 7 deletions
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
@@ -59,17 +59,16 @@ sub _readconfig {
@path = parse_line('\s+', 0, $1);
if (@path == 1 && $path[0] eq 'include') {
$include = 1;
} else {
$include = 0;
$self->add_node(\@path,
- new Config::AST::Node::Section(locus => $locus));
+ new Config::AST::Node::Section($self, locus => $locus));
}
} elsif (/([\w_-]+)\s*=\s*(.*)/) {
my ($k, $v) = ($1, $2);
- $k = lc($k) if $self->{_ci}; #FIXME:private member
if ($include) {
if ($k eq 'path') {
$self->_readconfig($v);
} elsif ($k eq 'pathopt') {
$self->_readconfig($v) if -f $v;
@@ -145,13 +144,13 @@ fragment:
use Config::Parser::Ini;
my $cf = new Config::Parser::Ini(filename => "config.ini");
On success, this returns a valid B<Config::Parser::Ini> object. On error,
the diagnostic message is issued using the B<error> method (see the description
-of the method in B<Config::AST>(3)) and the module croaks.
+of the method in L<Config::AST>(3)) and the module croaks.
This usage, although simple, has one major drawback - no checking is performed
on the input file, except for the syntax check. To fix this, you can supply
a dictionary (or I<lexicon>) of allowed keywords along with their values.
Such a dictionary is itself a valid ini file, where the value of each
keyword describes its properties. The dictionary is placed in the B<__DATA__>
@@ -197,13 +196,13 @@ Then, to parse the configuration file, it will suffice to do:
One advantage of this approach is that it will allow you to install
additional validation for the configuration statements using the
B<:check> option. The argument to this option is the name of a
method which will be invoked after parsing the statement in order
to verify its value. It is described in detail below (see the section
-B<SYNTAX DEFINITION> in the documentation of B<Config::Parser>).
+B<SYNTAX DEFINITION> in the documentation of L<Config::Parser>).
For example, if you wish to ensure that the value of the C<root> setting
in C<core> section points to an existing directory, you would do:
package App::MyConf;
use Config::Parser::Ini;
@@ -252,20 +251,20 @@ File handle to read from. If it is not supplied, new handle will be
created by using B<open> on the supplied filename.
=item B<lexicon>
Dictionary of allowed configuration statements in the file. You will not
need this parameter. It is listed here for completeness sake. Refer to
-the B<Config::AST> constructor for details.
+the L<Config::AST> constructor for details.
=back
=head1 METHODS
-All methods are inherited from B<Config::Parser>. Please see its
+All methods are inherited from L<Config::Parser>. Please see its
documentation for details.
=head1 SEE ALSO
-B<Config::Parser>(3), B<Config::AST>(3).
+L<Config::Parser>(3), L<Config::AST>(3).
=cut

Return to:

Send suggestions and report system problems to the System administrator.