Config:...Template(3)

πŸ“¦ version 1.0, in epel 9

πŸ¦‹ Config::Generator::Template(3) β€” the Perl manpage, but make it a group chat

Okay bestie, so this is a page from the User Contributed Perl Documentation for Config::Generator::Template, and honestly? It's giving "quiet little module that does a lot of heavy lifting." Come sit with me πŸ’–


✨ NAME ✨

Config::Generator::Template β€” literally just Config::Generator template support. That's the whole name. Short, sweet, iconic. πŸ‘‘


🌸 DESCRIPTION 🌸

So this module eases configuration file generation by hooking you up with template support. No cap.

A template is, like, a file with markup in it. You feed it a high-level configuration, and the template gets processed and transformed into a low-level configuration file. That's the whole vibe β€” high-level in, low-level out, slay. ✨


πŸŽ€ SYNTAX πŸŽ€

This is the part you're gonna screenshot, bestie. The template commands are enclosed within <{ and }>. And if PATH represents a path in the high-level configuration:

  • <{PATH}> β€” gets replaced by the value of PATH. Simple. Gorgeous. πŸ’…
  • <{open()}> β€” gets replaced by <{ (yes, the opener itself, meta much?)
  • <{close()}> β€” gets replaced by }>
  • <{if(PATH)}>xxx<{endif(PATH)}> β€” becomes xxx if PATH is true, or "" otherwise. And like, this is done using Perl's conditional testing, iykyk.
  • <{ifnot(PATH)}>xxx<{endif(PATH)}> β€” same as if() but negated. Flip it and reverse it πŸ¦‹
  • <{if_true(PATH)}>xxx<{endif(PATH)}> β€” same as if() but tested using Config::Validator's is_true()
  • <{if_false(PATH)}>xxx<{endif(PATH)}> β€” same as if() but tested using Config::Validator's is_false()
  • <{ifdef(PATH)}>xxx<{endif(PATH)}> β€” becomes xxx if PATH is defined (i.e. set), or "" otherwise
  • <{ifndef(PATH)}>xxx<{endif(PATH)}> β€” same as ifdef() but negated. Again with the flipping πŸ”₯
Heads up bestie: if_true() and if_false() lean on Config::Validator, not plain Perl truthiness. Different vibe check, different results. Don't mix them up πŸ™ˆ

πŸ’œ FUNCTIONS πŸ’œ

This module provides the following functions β€” and listen, none of them are exported by default, so you gotta ask nicely:

  • declare_template(NAME...) β€” declare one or more template names so they can be customized using the /Template schema πŸŽ€
  • expand_template(NAME[, HASH]) β€” read and process the named template, using the given hash as well as the high-level configuration
  • process_template(TEMPLATE, HASH...) β€” process the given template string using the given hashes
  • read_template(NAME) β€” return the contents of the named template, unprocessed. Raw. Untouched. Just how it came into this world 🌈

πŸ‘‘ AUTHOR πŸ‘‘

Lionel Cons <http://cern.ch/lionel.cons> β€” absolute main character energy fr fr.

Copyright (C) CERN 2013-2016 β€” so yeah, CERN owns this one, and that's genuinely iconic of them ⭐


And that's the whole page, bestie!! 🫢 Per the footer: this was perl v5.32.1, dated 2019-07-26, and it's Config:...Template(3) all day long. Now go generate some configs, you gorgeous little templating machine πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from