| Any::Template::ProcessDir(3pm) | User Contributed Perl Documentation | Any::Template::ProcessDir(3pm) |
Any::Template::ProcessDir -- Process a directory of templates
version 0.08
use Any::Template::ProcessDir;
# Process templates and generate result files in a single directory
#
my $pd = Any::Template::ProcessDir->new(
dir => '/path/to/dir',
process_text => sub {
my $template = Any::Template->new( Backend => '...', String => $_[0] );
$template->process({ ... });
}
);
$pd->process_dir();
# Process templates and generate result files to a separate directory
#
my $pd = Any::Template::ProcessDir->new(
source_dir => '/path/to/source/dir',
dest_dir => '/path/to/dest/dir',
process_file => sub {
my $file = $_[0];
# do something with $file, return content
}
);
$pd->process_dir();
Recursively processes a directory of templates, generating a set of result files in the same directory or in a parallel directory. Each file in the source directory may be template-processed, copied, or ignored depending on its pathname.
my $pd = Any::Template::ProcessDir->new(
dir => '/path/to/dir',
...
);
my $pd = Any::Template::ProcessDir->new(
source_dir => '/path/to/source/dir',
dest_dir => '/path/to/dest/dir',
...
);
Any file in the source directory that does not have this suffix (or "ignore_file_suffix") will simply be copied to the destination.
Any::Template
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| 2015-02-07 | perl v5.20.2 |