View on
MetaCPAN
Jan Hudec > Config-Maker-0.007 > Config::Maker::Config

Download:
Config-Maker-0.007.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Config::Maker::Config - This class represents the parsed configuration data.

SYNOPSIS ^

  use Config::Maker::Config

  $config = Config::Maker::Config->new($file);

DESCRIPTION ^

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.

Rule body

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.

anon_group

The body_anon_group rule describes blocks with no indentifier/value, that contain more options. It has no extra arguments.

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.

Rule value

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.

Simple values

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.

Complex values

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.

AUTHOR ^

Jan Hudec <bulb@ucw.cz>

COPYRIGHT AND LICENSE ^

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.

SEE ALSO ^

perl(1), Config::Maker(3pm), Parse::RecDescent(3pm).

syntax highlighting: