Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Template::Mustache(3) User Contributed Perl DocumentationTemplate::Mustache(3)

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

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

	   Standard hash constructor.

	   Parameters:

	   o   %args --	Initialization data.

	   Returns:

	   o   (Template::Mustache) -- A new instance.

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

	   Reads a named partial off disk.

	   Parameters:

	   o   (String)	$name -- 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.

       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

	       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) $tmpl -- 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) $data	-- 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) $tmpl -- The template to render.

	       o   (Hash, Class, Object) $data -- 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) $tmpl -- The template to render.

	       o   (Hash, Class, Object) $data -- Data to be interpolated into
		   the template.

	       o   (Code) $partials -- 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) $tmpl -- The template to render.

	       o   (Hash, Class, Object) $data -- Data to be interpolated into
		   the template.

	       o   (Class, Object) $partials --	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) $tmpl -- The template to render.

	       o   (Hash, Class, Object) $data -- Data to be interpolated into
		   the template.

	       o   (Hash) $partials -- A hash containing partials.

	       Returns:

	       o   (String) -- The fully rendered template.

       template
	       template($receiver) # =>	String

	   Reads the template off disk.

	   Returns:

	   o   (String)	-- The contents	of the template_file under
	       template_path.

       template_extension
	       template_extension # => String

	   File	extension for templates	and partials.

	   Returns:

	   o   (String)	-- $Template::Mustache::template_extension (defaults
	       to 'mustache').

       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:

	   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

       template_namespace
	       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.

       template_path
	       template_path # => String

	   Filesystem path for template	and partial lookups.

	   Returns:

	   o   (String)	-- $Template::Mustache::template_path (defaults	to
	       '.').

AUTHOR
       Pieter van de Bruggen

perl v5.32.1			  2011-02-14		 Template::Mustache(3)

NAME | METHODS | AUTHOR

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Template::Mustache&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help