Config:...Dynamic(3)
π Config::Grammar::Dynamic(3) β the perl one, from the User Contributed Perl Documentation β¨
okay so bestie, buckle up π this is Config::Grammar::Dynamic, and it's a grammar-based, user-friendly config parser. Yes, all three of those words at once π
πΈ NAME πΈ
Config::Grammar::Dynamic β literally a grammar-based, user-friendly config parser. periodt.
π¦ DESCRIPTION π¦
So Config::Grammar::Dynamic is like Config::Grammar, but it's the glow-up version with extra features π
and those extra features are specifically for building configuration grammars that are dynamic β meaning the syntax literally changes based on configuration entries in the same file. the way that works?? main character energy, no cap β¨
Here are the extra keys you can specify in the grammar when you're using this module π
π§ Special Section Keys π
_dynβ a subroutine reference (function pointer) that gets called when a new section of this syntax is encountered π«Ά the subroutine receives 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. then the subroutine can go modify the grammar tree dynamically. iconic behavior honestly β¨_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 between the resulting grammar and the original one get documented. this module can currently document differences in the_varslist (listing new variables and removed ones) and differences in the_sectionslist (listing the new and removed sections) π_recursiveβ an array containing the list of those sub-sections that are recursive, i.e. that can contain a new sub-section with the same syntax as themselves π
lowkey important note: 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 gets called when the variable is assigned some value in the config file π the subroutine gets three arguments: the name of the variable, the value assigned, and a reference to the grammar tree of this section. then it can modify the grammar tree dynamically. slay π
heads up bestie π no _dyn() call is made for default and inherited values of the variable. not me pointing that out... but fr fr, remember it.
_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 versus the original one are documented. this module can currently document differences in the_varslist (listing new variables and removed ones) and differences in the_sectionslist (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 β the icons who made this happen π«Ά
okay that's the whole page bestie, go forth and parse dynamically β¨π
mwah π this lil rewrite was brought to you by perl v5.40.2, dated 2024-02-21 β catch you on the flip side π¦
π¦ where this page comes from
- alpine 3.22: perl-config-grammar-doc 1.13-r4 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms