| Config::YAMLMacros |
use Config::YAMLMacros;
my $config = get_config('/some/file');
This module is a wrapper around loading YAML configuration files. It does several things:
Initial tabs on lines are expanded so that YAML doesn't choke on invisible variations in whitespace.
The YAML file may be split into sections, divided with --- lines.
The sections will be merged together to create the final result.
You can declare string replacements to use for the rest of the file. For example:
--- REPLACE: %FOO%: BAR ---
You can declare string replacements where the value of the replacement string is evaluated as a perl expression:
--- EVAL_REPLACE: %FOO%: $ENV{HOME} ---
You can turn off the replacements with a NO_REPLACE directive:
--- NO_REPLACE: %FOO% ---
You can include additional files as part of your configuration file. They will be merged in.
--- INCLUDE: filename.yml ---
You can specify that the new file override stuff that has already been seen in the current file:
--- OVERRIDE_FROM: filename.yml ---
For the INCLUDE, OVERRIDE_FROM, and NO_REPLACE directives, they
can be either lists or a single item:
--- OVERRIDE_FROM: - file1.yml - file2.yml NO_REPLACE: - %FOO% - %BAR% INCLUDE: justone.yml ---
These new directives need to be in a yaml block all by themselves
(delimited by ---).
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.
| Config::YAMLMacros |