Lionel Cons

NAME

Config::Generator::Template - Config::Generator template support

DESCRIPTION

This module eases configuration file generation by providing template support. A template is a file with markup. Given a high-level configuration, the template can be processed and transformed into a low-level configuration file.

SYNTAX

The template commands are enclosed within "<{" and "}>". If PATH represents a path in the high-level configuration:

  • "<{PATH}>" will be replaced by the value of PATH

  • "<{open()}>" will be replaced by "<{"

  • "<{close()}>" will be replaced by "}>"

  • "<{if(PATH)}>xxx<{endif(PATH)}>" will be replaced by "xxx" if PATH is true or "" otherwise (this is done using Perl's conditional testing)

  • "<{if_not(PATH)}>xxx<{endif(PATH)}>" is the same but negated

  • "<{if_true(PATH)}>xxx<{endif(PATH)}>" is the same but tested using Config::Validator's is_true()

  • "<{if_false(PATH)}>xxx<{endif(PATH)}>" is the same but tested using Config::Validator's is_false()

FUNCTIONS

This module provides the following functions (none of them being exported by default):

declare_template(NAME...)

declare one or more template names so that 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)

AUTHOR

Lionel Cons http://cern.ch/lionel.cons

Copyright (C) CERN 2013-2014