Config::Grammar::Dynamic(3)

NAME
Config::Grammar::Dynamic - A grammar-based, user-friendly config parser

DESCRIPTION
Config::Grammar::Dynamic is like Config::Grammar but with some additional features useful for building configuration grammars that are dynamic, i.e. where the syntax changes according to configuration entries in the same file.

The following keys can be additionally specified in the grammar when using this module:

  Special Section Keys

_dyn
    A subroutine reference (function pointer) that will be called when a new section of this syntax is encountered. The subroutine will get three arguments: the syntax of the section name (string or regexp), the actual name encountered (this will be the same as the first argument for non-regexp sections) and a reference to the grammar tree of the section. This subroutine can then modify the grammar tree dynamically.

_dyndoc
    A hash reference that lists interesting names for the section that should be documented. The keys of the hash are the names and the values in the hash are strings that can contain an explanation for the name. The _dyn() subroutine is then called for each of these names and the differences of the resulting grammar and the original one are documented. This module can currently document differences in the _vars list, listing new variables and removed ones, and differences in the _sections list, listing the new and removed sections.

_recursive
    Array containing the list of those sub-sections that are recursive, ie. that can contain a new sub-section with the same syntax as themselves.

    The same effect can be accomplished with circular references in the grammar tree or a suitable _dyn section subroutine (see below}, so this facility is included just for convenience.

  Special Variable Keys

_dyn
    A subroutine reference (function pointer) that will be called when the variable is assigned some value in the config file. The subroutine will get three arguments: the name of the variable, the value assigned and a reference to the grammar tree of this section. This subroutine can then modify the grammar tree dynamically.

    Note that no _dyn() call is made for default and inherited values of the variable.

_dyndoc
    A hash reference that lists interesting values for the variable that should be documented. The keys of the hash are the values and the values in the hash are strings that can contain an explanation for the value. The _dyn() subroutine is then called for each of these values and the differences of the resulting grammar and the original one are documented. This module can currently document differences in the _vars list, listing new variables and removed ones, and differences in the _sections list, listing the new and removed sections.

COPYRIGHT
Copyright (c) 2000-2005 by ETH Zurich. All rights reserved. Copyright (c) 2007 by David Schweikert. All rights reserved.

LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS
David Schweikert, Tobias Oetiker, Niko Tyni