NAME

Dist::Zilla::Plugin::Templates - Treat source files as templates

VERSION

Version v0.6.4.1, released on 2018-03-20 22:48 UTC. This is a trial release.

WHAT?

Dist-Zilla-Plugin-Templates (or just Templates for brevity) is a Dist-Zilla plugin allowing developers to insert Perl code fragments into arbitrary source text files, which become templates. When Dist::Zilla builds the distribution each code fragment is evaluated and replaced with result of evaluation.

This is Dist::Zilla::Plugin::Templates module documentation. Read this if you are going to hack or extend Dist-Zilla-Plugin-Templates.

If you want to treat source files as templates, read the manual. General topics like getting source, building, installing, bug reporting and some others are covered in the README.

DESCRIPTION

Implementation of the plugin is trivial. It just consumes few roles which do all the work: FileFinderUser provides a list of files, TextTemplater process them.

OBJECT METHODS

munge_files

This is the primary method of the plugin. It is called by Dist::Zilla during build. The method iterates through the files provided by $self->found_files (a method defined in FileFinderUser role) and process each file with $self->fill_in_file (a method defined in TextTemplater role). That's all, folks.

include

This method implements same-name template function. Normally, templates should call the function, not method:

{{ include( 'filename' ); }}

However, if something wrong with the function, file inclusion can be made through the method call:

{{ $plugin->include( 'filename' ); }}

SEE ALSO

Dist::Zilla
Dist::Zilla::Role::FileFinderUser
Dist::Zilla::Role::TextTemplater
Text::Template
Dist::Zilla::Plugin::Templates::Manual

AUTHOR

Van de Bugger <van.de.bugger@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2015, 2016, 2018 Van de Bugger

License GPLv3+: The GNU General Public License version 3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>.

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.