Config::Maker::Config - This class represents the parsed configuration data.
use Config::Maker::Config $config = Config::Maker::Config->new($file);
This module parses the configuration data. It contains the (relatively large) Parse::RecDescent parser for parsing the configuration files and a simple constructor for parsing files.
The parser has two major parametrized rules: the body and the value.
body
value
The body rule takes a list of arguments, where the first one is the body type to be used and the rest are lists of arguments for possible subrules. There are three types of body defined:
simple
The body_simple rule describes simple options (without suboptions). It has one additional argument -- the argument list for a value. The value has to be terminated with a semicolon.
body_simple
anon_group
The body_anon_group rule describes blocks with no indentifier/value, that contain more options. It has no extra arguments.
body_anon_group
named_group
The body_named_group rule describes an option with an identifier/value and suboptions. It has one additional argument -- the argument list for a value.
body_named_group
This describes various types of values that can be given to options. There are simple values and complex values. For now, all simple values are manipulated as strings, but the more precise specification allows to check them during parsing of the configuration. The complex values are represented by complex perl data structures. Currently these can only be used from [{perl code}] in templates. They are primarily designed for use in metaconfig.
[{perl code}]
None of the simple values takes extra arguments.
void
No option at all.
string
Either a single or double quoted string, or, if it does not contain too funny characters a bareword.
identifier
Starts with an alphabetic character and continues with alphanumerics, dashes and underscores. Unicode word characters are recognized as alphabetic.
dns_name
Just ASCII letters, numbers and dashes.
dns_zone
Sequence of dns_names separated, and possibly terminated, with dots.
ipv4
A dotted deciaml IPv4 address. Only four-byte notation is recognized. The shorthand ones are not.
port
A decimal integer from 0 through 65535.
ipv4_port
An ipv4 and a port separated with a colon.
ipv4_mask
And ipv4, a slash and an integer from 0 to 32.
mac
Six tuples of hex digits, separated by colons.
perlcode
A piece of perl code enclosed in curly braces ({}). Represented as a string.
{}
The complex values consist of other value types. They take arguments that shall be passed to the value subrules.
list
A space separated list of values. Remaining arguments are passed to the recursive calls of value rules.
zero_list
Like above, but empty list is valid.
nested_list
A space separated list of values or sublists in square brackets ([]). Remaining arguments are, again, passed to the recursive calls of value rules.
[]
nestlist_elem
This is the actual type of elements in the nested list. It is either a single element of specified type, or a nested_list containing that type.
pair
Space separated pair of values. Takes two array arguments, the respective types of the two values.
Jan Hudec <bulb@ucw.cz>
Copyright 2004 Jan Hudec. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1), Config::Maker(3pm), Parse::RecDescent(3pm).
To install Config::Maker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Maker
CPAN shell
perl -MCPAN -e shell install Config::Maker
For more information on module installation, please visit the detailed CPAN module installation guide.