NAME

Template::Overlay - A powerful, and simple, library for resolving placeholders in templated files

VERSION

version 1.16

SYNOPSIS

use Template::Overlay;
use Template::Resolver;

my $overlay_me = Template::Overlay->new(
    '/path/to/base/folder',
    Template->Resolver->new($entity),
    key => 'REPLACEME');
$overlay_me->overlay(
    ['/path/to/template/base','/path/to/another/template/base'],
    to => '/path/to/processed');

DESCRIPTION

This provides the ability ot overlay a set of files with a set of resolved templates. It uses Template::Resolver to resolve each file.

CONSTRUCTORS

new($base, $resolver, [%options])

Creates a new overlay processor for the files in $base using $resolver to process the template files. The available options are:

key

The template key used by Template::Resolver-<resolve.

METHODS

overlay($overlays, [%options])

Overlays the $base directory (specified in the constructor) with the resolved templates from the directories in $overlays. $overlays can be either a path, or an array reference containing paths. If multiple $overlays contain the same template, the last one in the array will take precedence. The available options are:

resolver

A callback, that if specified, will be called for each template file found. It will be called with two arguments: the first is the path to the template file, the second is the path to the destination file. If the callback returns a falsey value, then it is assumed that the supplied callbac decided not to process this file and processing will proceed as normal. Otherwise, it is assumed that the callback handled processing of the file, so the default processing will be skipped.

to

If specified, the files in $base will not be not be modified. Rather, they will be copied to the path specified by $to and the overlays will be processed on top of that directory.

AUTHOR

Lucas Theisen <lucastheisen@pastdev.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Lucas Theisen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

SEE ALSO

Please see those modules/websites for more information related to this module.