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 _vars list (listing new variables and removed ones) and differences in the _sections list (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 _vars list (listing new variables and removed ones) and differences in the _sections list (listing the new and removed sections) πŸ¦‹

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