Template::Overlay - A powerful, and simple, library for resolving placeholders in templated files
version 1.16
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');
This provides the ability ot overlay a set of files with a set of resolved templates. It uses Template::Resolver to resolve each file.
Creates a new overlay processor for the files in $base using $resolver to process the template files. The available options are:
$base
$resolver
The template key used by Template::Resolver-<resolve.
Template::Resolver-<resolve
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:
$overlays
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.
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.
$to
Lucas Theisen <lucastheisen@pastdev.com>
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.
Please see those modules/websites for more information related to this module.
Template::Resolver
Template::Transformer
https://github.com/lucastheisen/template-resolver
To install Template::Resolver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Resolver
CPAN shell
perl -MCPAN -e shell install Template::Resolver
For more information on module installation, please visit the detailed CPAN module installation guide.