1Config::Grammar::DynamiUcs(e3r)Contributed Perl DocumentCaotnifoing::Grammar::Dynamic(3)
2
3
4
6 Config::Grammar::Dynamic - A grammar-based, user-friendly config parser
7
9 Config::Grammar::Dynamic is like Config::Grammar but with some
10 additional features useful for building configuration grammars that are
11 dynamic, i.e. where the syntax changes according to configuration
12 entries in the same file.
13
14 The following keys can be additionally specified in the grammar when
15 using this module:
16
17 Special Section Keys
18 _dyn A subroutine reference (function pointer) that will be
19 called when a new section of this syntax is encountered.
20 The subroutine will get three arguments: the syntax of the
21 section name (string or regexp), the actual name
22 encountered (this will be the same as the first argument
23 for non-regexp sections) and a reference to the grammar
24 tree of the section. This subroutine can then modify the
25 grammar tree dynamically.
26
27 _dyndoc A hash reference that lists interesting names for the
28 section that should be documented. The keys of the hash are
29 the names and the values in the hash are strings that can
30 contain an explanation for the name. The _dyn() subroutine
31 is then called for each of these names and the differences
32 of the resulting grammar and the original one are
33 documented. This module can currently document differences
34 in the _vars list, listing new variables and removed ones,
35 and differences in the _sections list, listing the new and
36 removed sections.
37
38 _recursive Array containing the list of those sub-sections that are
39 recursive, ie. that can contain a new sub-section with the
40 same syntax as themselves.
41
42 The same effect can be accomplished with circular
43 references in the grammar tree or a suitable _dyn section
44 subroutine (see below}, so this facility is included just
45 for convenience.
46
47 Special Variable Keys
48 _dyn A subroutine reference (function pointer) that will be
49 called when the variable is assigned some value in the
50 config file. The subroutine will get three arguments: the
51 name of the variable, the value assigned and a reference to
52 the grammar tree of this section. This subroutine can then
53 modify the grammar tree dynamically.
54
55 Note that no _dyn() call is made for default and inherited
56 values of the variable.
57
58 _dyndoc A hash reference that lists interesting values for the
59 variable that should be documented. The keys of the hash
60 are the values and the values in the hash are strings that
61 can contain an explanation for the value. The _dyn()
62 subroutine is then called for each of these values and the
63 differences of the resulting grammar and the original one
64 are documented. This module can currently document
65 differences in the _vars list, listing new variables and
66 removed ones, and differences in the _sections list,
67 listing the new and removed sections.
68
70 Copyright (c) 2000-2005 by ETH Zurich. All rights reserved. Copyright
71 (c) 2007 by David Schweikert. All rights reserved.
72
74 This program is free software; you can redistribute it and/or modify it
75 under the same terms as Perl itself.
76
78 David Schweikert, Tobias Oetiker, Niko Tyni
79
80
81
82perl v5.28.1 2019-03-20 Config::Grammar::Dynamic(3)