GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEMPLATE::MUSTACHE (3)

.ds Aq ’

NAME

Template::Mustache - Template::Mustache is an implementation of the fabulous Mustache templating language for Perl 5.8 and later

CONTENTS

METHODS

    Class Methods

<B>newB>


    new($class, %args) # => Template::Mustache



Standard hash constructor.

Parameters:
o <B>B>%args<B>B> — Initialization data.

Returns:
o (Template::Mustache) — A new instance.

<B>partialB>


    partial($receiver, $name) # => String



Reads a named partial off disk.

Parameters:
o (String) <B>B>$name<B>B> — The name of the partial to lookup.

Returns:
o (String) — The contents of the partial (in template_path, of type template_extension), or the empty string, if the partial does not exist.

<B>renderB>


    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



  Renders a class or instance’s template with data from the receiver. The template will be retrieved by calling the template method. Partials will be fetched by partial.

Returns:
o (String) — The fully rendered template.

 



    render($tmpl) # => String



  Renders the given template with data from the receiver. Partials will be fetched by partial.

Parameters:
o (String) <B>B>$tmpl<B>B> — The template to render.

 

Returns:
o (String) — The fully rendered template.

 



    render($data) # => String



  Renders a class or instance’s template with data from the receiver. The template will be retrieved by calling the template method. Partials will be fetched by partial.

Parameters:
o (Hash, Object) <B>B>$data<B>B> — Data to be interpolated into the template.

 

Returns:
o (String) — The fully rendered template.

 



    render($tmpl, $data) # => String



  Renders the given template with the given data. Partials will be fetched by partial.

Parameters:
o (String) <B>B>$tmpl<B>B> — The template to render.
o (Hash, Class, Object) <B>B>$data<B>B> — Data to be interpolated into the template.

 

Returns:
o (String) — The fully rendered template.

 



    render($tmpl, $data, $partials) # => String



  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:
o (String) <B>B>$tmpl<B>B> — The template to render.
o (Hash, Class, Object) <B>B>$data<B>B> — Data to be interpolated into the template.
o (Code) <B>B>$partials<B>B> — A function used to lookup partials.

 

Returns:
o (String) — The fully rendered template.

 



    render($tmpl, $data, $partials) # => String



  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:
o (String) <B>B>$tmpl<B>B> — The template to render.
o (Hash, Class, Object) <B>B>$data<B>B> — Data to be interpolated into the template.
o (Class, Object) <B>B>$partials<B>B> — A thing that responds to partial names.

 

Returns:
o (String) — The fully rendered template.

 



    render($tmpl, $data, $partials) # => String



  Renders the given template with the given data. Partials will be looked up in the given hash.

Parameters:
o (String) <B>B>$tmpl<B>B> — The template to render.
o (Hash, Class, Object) <B>B>$data<B>B> — Data to be interpolated into the template.
o (Hash) <B>B>$partials<B>B> — A hash containing partials.

 

Returns:
o (String) — The fully rendered template.

 

<B>templateB>


    template($receiver) # => String



Reads the template off disk.

Returns:
o (String) — The contents of the template_file under template_path.

<B>template_extensionB>


    template_extension # => String



File extension for templates and partials.

Returns:
o (String) — $Template::Mustache::template_extension (defaults to ’mustache’).

<B>template_fileB>


    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:
o Templates have the extension given by template_extension (’mustache’ by default).
o Templates will have template_namespace removed, if it appears at the beginning of the package name.
o Template filename resolution will short circuit if $Template::Mustache::template_file is set.
o Template filename resolution may be overriden in subclasses.
o Template files will be resolved against template_path, not $PERL5LIB.

Returns:
o (String) — The path to the template file, relative to template_path.

See Also:
o template

<B>template_namespaceB>


    template_namespace # => String



Package namespace to ignore during template lookups.

As an example, if you subclass Template::Mustache as the class My::Heavily::Namepaced::Views::SomeView, calls to render will automatically try to load the template ./My/Heavily/Namespaced/Views/SomeView.mustache under the 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:
o (String) — The empty string.

<B>template_pathB>


    template_path # => String



Filesystem path for template and partial lookups.

Returns:
o (String) — $Template::Mustache::template_path (defaults to ’.’).

AUTHOR

Pieter van de Bruggen
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEMPLATE::MUSTACHE (3) 2011-02-14

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.