NAME
App::Scaffolder::Template - Represent a template for App::Scaffolder
VERSION
version 0.001000
SYNOPSIS
use Path::Class::Dir;
use App::Scaffolder::Template;
my $template = App::Scaffolder::Template->new({
name => 'name_of_the_template',
path => [
Path::Class::Dir->new('/first/path/belonging/to/template'),
Path::Class::Dir->new('/second/path/belonging/to/template'),
]
});
DESCRIPTION
App::Scaffolder::Template represents a template. A template consists of one or more directories containing files that should be copied to a target directory when processing it. If a file has a .tt
extension, it will be passed through Template before it is written to a target file without the .tt
suffix. Thus the template
foo
|-- subdir
| |-- template.txt.tt
| `-- sub.txt
|-- top-template.txt.tt
`-- bar.txt
would result in the following structure after processing:
output
|-- subdir
| |-- template.txt
| `-- sub.txt
|-- top-template.txt
`-- bar.txt
METHODS
new
Constructor, creates new instance.
Parameters
This method expects its parameters as a hash reference.
- name
-
Name of the template.
- path
-
Search path for files that belong to the template. If more than one file has the same relative path, only the first one will be used, so it is possible to override files that come 'later' in the search path.
add_path_entry
Push another directory on the search path.
get_path
Getter for the template file search path.
Result
The template file search path.
get_name
Getter for the name.
Result
The name.
process
Process the template.
Parameters
This method expects its parameters as a hash reference.
- target
-
Target directory where the output should be stored.
- variables
-
Hash reference with variables that should be made available to templates.
Result
A list with the created files on succes, an exception otherwise.
get_template_files
Getter for the file that belong to the template.
Result
A hash reference containing hash references with information about the files.
AUTHOR
Manfred Stock <mstock@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Manfred Stock.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.