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
Text::Hogan(3) User Contributed Perl Documentation Text::Hogan(3)

Text::Hogan - A mustache templating engine statement-for-statement cloned from hogan.js

version 2.03

Text::Hogan is a statement-for-statement rewrite of hogan.js <http://twitter.github.io/hogan.js/> in Perl.

It is a mustache <https://mustache.github.io/> templating engine which supports pre-compilation of your templates into pure Perl code, which then renders very quickly.

It passes the full mustache spec <https://github.com/mustache/spec>.

    use Text::Hogan::Compiler;

    my $text = "Hello, {{name}}!";

    my $compiler = Text::Hogan::Compiler->new;
    my $template = $compiler->compile($text);

    say $template->render({ name => "Alex" });

See Text::Hogan::Compiler and Text::Hogan::Template for more details.

The template format is documented in mustache(5) <https://mustache.github.io/mustache.5.html>.

hogan.js <http://twitter.github.io/hogan.js/> is the original library that Text::Hogan is based on. It was written and is maintained by Twitter. It runs on Node.js and pre-compiles templates to pure JavaScript.

Text::Caml supports searching for partials by file name, by default .caml but that can be configured.

Template::Mustache is used by Dancer::Template::Mustache and Dancer2::Template::Mustache. It supports compile once, render many times, but does not allow dumping the compiled form to disk.

Mustache::Simple largely supports the Mustache spec, but skips the whitespace and decimal tests (its behaviour with decimals is the same as Text::Hogan with 'numeric_string_as_string' option enabled.) It supports passing objects with getters to the context hash, so that {{name}} can be rendered from $object->name if $object->can('name') returns true.

Started out statement-for-statement copied from hogan.js by Twitter!

Initial translation by Alex Balhatchet (alex@balhatchet.net)

Further improvements from:

Ed Freyfogle Mohammad S Anwar Ricky Morse Jerrad Pierce Tom Hukins Tony Finch Yanick Champoux

2019-12-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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