Any-Template-ProcessDir
view release on metacpan or search on metacpan
lib/Any/Template/ProcessDir.pm view on Meta::CPAN
=head1 CONSTRUCTOR
=head2 Specifying directory/directories
=over
=item *
If you want to generate the result files in the B<same> directory as the
templates, just specify I<dir>.
my $pd = Any::Template::ProcessDir->new(
dir => '/path/to/dir',
...
);
=item *
If you want to generate the result files in a B<separate> directory from the
templates, specify I<source_dir> and I<dest_dir>.
my $pd = Any::Template::ProcessDir->new(
source_dir => '/path/to/source/dir',
dest_dir => '/path/to/dest/dir',
...
);
=back
=head2 Specifying how to process templates
=over
=item process_file
A code reference that takes the full template filename and the
C<Any::Template::ProcessDir> object as arguments, and returns the result
string. This can use L<Any::Template> or another method altogether. By default
it calls L</process_text> on the contents of the file.
=item process_text
A code reference that takes the template text and the
C<Any::Template::ProcessDir> object as arguments, and returns the result
string. This can use L<Any::Template> or another method altogether.
=back
=head2 Optional parameters
=over
=item dir_create_mode
Permissions mode to use when creating destination directories. Defaults to
0775. No effect if you are using a single directory.
=item file_create_mode
Permissions mode to use when creating destination files. Defaults to 0444
(read-only), so that destination files are not accidentally edited.
=item ignore_files
Coderef which takes a full pathname and returns true if the file should be
ignored. By default, all files will be considered.
=item readme_filename
Name of a README file to generate in the destination directory - defaults to
"README". No file will be generated if you pass undef or if you are using a
single directory.
=item template_file_suffix
Suffix of template files in source directory. Defaults to ".src". This will be
removed from the destination file name.
Any file in the source directory that does not have this suffix (or
L</ignore_file_suffix>) will simply be copied to the destination.
=back
=head1 METHODS
=over
=item process_dir
Process the directory. If using multiple directories, the destination directory
will be removed completely and recreated, to eliminate any old files from
previous processing.
=back
=head1 SEE ALSO
L<Any::Template>
=head1 COPYRIGHT AND LICENSE
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.
=cut
( run in 0.697 second using v1.01-cache-2.11-cpan-39bf76dae61 )