Test::Lintian::Templates -- Helper routines dealing with
templates
use Test::Lintian::Templates qw(fill_template);
my $data = { 'placeholder' => 'value'
}; my $file = '/path/to/generated/file';
fill_template("$file.in", $file,
$data);
Routines for dealing with templates in Lintian test
specifications.
- copy_skeleton_template_sets(INSTRUCTIONS,
RUN_PATH, SUITE, TEST_SET)
- Copies template sets belonging to SUITE into the test working directory
RUN_PATH according to INSTRUCTIONS. The INSTRUCTIONS are the target
directory relative to RUN_PATH followed by the name of the template set in
parentheses. Multiple such instructions must be separated by commas.
- remove_surplus_templates(SRC_DIR,
TARGET_DIR)
- Removes from TARGET_DIR any templates that have corresponding originals in
SRC_DIR.
- fill_skeleton_templates(INSTRUCTIONS,
HASH, EPOCH, RUN_PATH, TEST_SET)
- Fills the templates specified in INSTRUCTIONS using the data in HASH. Only
fills templates when the generated files are not present or are older than
either the file modification time of the template or the age of the data
as evidenced by EPOCH. The INSTRUCTIONS are the target directory relative
to RUN_PATH followed by the name of the whitelist in parentheses. Multiple
instructions must be separated by commas.
- fill_whitelisted_templates(DIR,
WHITE_LIST, HASH, HASH_EPOCH)
- Generates all files in array WHITE_LIST relative to DIR from their
templates, which are assumed to have the same file name but with extension
'.in', using data provided in HASH. The optional argument HASH_EPOCH can
be used to preserve files when no generation is necessary.
- fill_all_templates(HASH,
DIR)
- Fills all templates in DIR with data from HASH.
- fill_template(TEMPLATE,
GENERATED, HASH, HASH_EPOCH, DELIMITERS)
- Fills template TEMPLATE with data from HASH and places the result in file
GENERATED. When given HASH_EPOCH, will evaluate beforehand if a
substitution is necessary based on file modification times. The optional
parameter DELIMITERS can be used to change the standard delimiters.