Config-Parser

 view release on metacpan or  search on metacpan

lib/Config/Parser/Ini.pm  view on Meta::CPAN

grouped into one or more sections.  A I<setting> has the form

  KEYWORD = VALUE

where I<KEYWORD> is the setting name and I<VALUE> is its value.
Syntactically, I<VALUE> is anything to the right of the equals sign and up
to the linefeed character terminating the line (ASCII 10), not including
the leading and trailing whitespace characters.

Each setting occupies one line.  Very long lines can be split over several
physical lines by ending each line fragment except the last with a backslash
character appearing right before the linefeed character.

A I<section> begins with a section declaration in the following form:

  [NAME NAME...]

Here, square brackets form part of the syntax.  Any number of I<NAME>s
can be present inside the square brackets.  The first I<NAME> must follow the
usual rules for a valid identifier name.  Rest of I<NAME>s can contain any
characters, provided that any I<NAME> that includes non-alphanumeric characters
is enclosed in a pair of double-quotes.  Any double-quotes and backslash
characters appearing within the quoted string must be escaped by prefixing
them with a single backslash.

The B<Config::Parser::Ini> module is a framework for parsing such files.

In the simplest case, the usage of this module is as simple as in the following
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 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



( run in 2.543 seconds using v1.01-cache-2.11-cpan-364913b4093 )