=for comment Documentation generated by YARD v0.6.4 and yard-pod-plugin v0.1.
=head1 NAME
Template::Mustache - Template::Mustache is an implementation of the fabulous Mustache templating
language for Perl 5.8 and later
=head1 METHODS
=head2 Class Methods
=over
=item B<<<< new >>>>
new($class, %args) # => Template::Mustache
Standard hash constructor.
Parameters:
=over
=item *
B<<<<< C<<<< %args >>>> >>>>> -- Initialization data.
=back
Returns:
=over
=item *
(I<<<< Template::Mustache >>>>) -- A new instance.
=back
=item B<<<< partial >>>>
partial($receiver, $name) # => String
Reads a named partial off disk.
Parameters:
=over
=item *
(I<<<< String >>>>) B<<<<< C<<<< $name >>>> >>>>> -- The name of the
partial to lookup.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The contents of the partial (in L<<<< S<<<<<
template_path >>>>>|template_path >>>>, of type L<<<< S<<<<<
template_extension >>>>>|template_extension >>>>), or the empty
string, if the partial does not exist.
=back
=item B<<<< render >>>>
render # => String
render($tmpl) # => String
render($data) # => String
render($tmpl, $data) # => String
render($tmpl, $data, $partials) # => String
render($tmpl, $data, $partials) # => String
render($tmpl, $data, $partials) # => String
Overloads:
render # => String
=over
Renders a class or instance's template with data from the receiver. The
template will be retrieved by calling the L<<<< S<<<<< template
>>>>>|template >>>> method. Partials will be fetched by L<<<< S<<<<<
partial >>>>>|partial >>>>.
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
render($tmpl) # => String
=over
Renders the given template with data from the receiver. Partials will
be fetched by L<<<< S<<<<< partial >>>>>|partial >>>>.
Parameters:
=over
=item *
(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
render.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
render($data) # => String
=over
Renders a class or instance's template with data from the receiver. The
template will be retrieved by calling the L<<<< S<<<<< template
>>>>>|template >>>> method. Partials will be fetched by L<<<< S<<<<<
partial >>>>>|partial >>>>.
Parameters:
=over
=item *
(I<<<< Hash, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> -- Data to
be interpolated into the template.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
render($tmpl, $data) # => String
=over
Renders the given template with the given data. Partials will be
fetched by L<<<< S<<<<< partial >>>>>|partial >>>>.
Parameters:
=over
=item *
(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
render.
=item *
(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
Data to be interpolated into the template.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
render($tmpl, $data, $partials) # => String
=over
Renders the given template with the given data. Partials will be looked
up by calling the given code reference with the partial's name.
Parameters:
=over
=item *
(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
render.
=item *
(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
Data to be interpolated into the template.
=item *
(I<<<< Code >>>>) B<<<<< C<<<< $partials >>>> >>>>> -- A function
used to lookup partials.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
render($tmpl, $data, $partials) # => String
=over
Renders the given template with the given data. Partials will be looked
up by calling the partial's name as a method on the given class or
object.
Parameters:
=over
=item *
(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
render.
=item *
(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
Data to be interpolated into the template.
=item *
(I<<<< Class, Object >>>>) B<<<<< C<<<< $partials >>>> >>>>> -- A
thing that responds to partial names.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
render($tmpl, $data, $partials) # => String
=over
Renders the given template with the given data. Partials will be looked
up in the given hash.
Parameters:
=over
=item *
(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
render.
=item *
(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
Data to be interpolated into the template.
=item *
(I<<<< Hash >>>>) B<<<<< C<<<< $partials >>>> >>>>> -- A hash
containing partials.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The fully rendered template.
=back
=back
=item B<<<< template >>>>
template($receiver) # => String
Reads the template off disk.
Returns:
=over
=item *
(I<<<< String >>>>) -- The contents of the L<<<< S<<<<<
template_file >>>>>|template_file >>>> under L<<<< S<<<<<
template_path >>>>>|template_path >>>>.
=back
=item B<<<< template_extension >>>>
template_extension # => String
File extension for templates and partials.
Returns:
=over
=item *
(I<<<< String >>>>) -- C<<<< $Template::Mustache::template_extension
>>>> (defaults to 'mustache').
=back
=item B<<<< template_file >>>>
template_file($receiver) # => String
The template filename to read. The filename follows standard Perl
module lookup practices (e.g. My::Module becomes My/Module.pm) with the
following differences:
=over
=item *
Templates have the extension given by L<<<< S<<<<< template_extension
>>>>>|template_extension >>>> ('mustache' by default).
=item *
Templates will have L<<<< S<<<<< template_namespace
>>>>>|template_namespace >>>> removed, if it appears at the beginning of
the package name.
=item *
Template filename resolution will short circuit if C<<<<
$Template::Mustache::template_file >>>> is set.
=item *
Template filename resolution may be overriden in subclasses.
=item *
Template files will be resolved against L<<<< S<<<<< template_path
>>>>>|template_path >>>>, not C<<<< $PERL5LIB >>>>.
=back
Returns:
=over
=item *
(I<<<< String >>>>) -- The path to the template file, relative to
L<<<< S<<<<< template_path >>>>>|template_path >>>>.
=back
See Also:
=over
=item *
L<<<< S<<<<< template >>>>>|template >>>>
=back
=item B<<<< template_namespace >>>>
template_namespace # => String
Package namespace to ignore during template lookups.
As an example, if you subclass C<<<< Template::Mustache >>>> as the
class C<<<< My::Heavily::Namepaced::Views::SomeView >>>>, calls to L<<<<
S<<<<< render >>>>>|render >>>> will automatically try to load the
template C<<<< ./My/Heavily/Namespaced/Views/SomeView.mustache >>>>
under the L<<<< S<<<<< template_path >>>>>|template_path >>>>. Since
views will very frequently all live in a common namespace, you can
override this method in your subclass, and save yourself some headaches.
Setting template_namespace to: yields template name:
My::Heavily::Namespaced::Views => SomeView.mustache
My::Heavily::Namespaced => Views/SomeView.mustache
Heavily::Namespaced =>
My/Heavily/Namespaced/Views/SomeView.mustache
As noted by the last example, namespaces will only be removed from the
beginning of the package name.
Returns:
=over
=item *
(I<<<< String >>>>) -- The empty string.
=back
=item B<<<< template_path >>>>
template_path # => String
Filesystem path for template and partial lookups.
Returns:
=over
=item *
(I<<<< String >>>>) -- C<<<< $Template::Mustache::template_path >>>>
(defaults to '.').
=back
=back
=head1 AUTHOR
Pieter van de Bruggen