Text::Hogan(3pm)
β¨ NAME β¨
Text::Hogan β a mustache templating engine, statement-for-statement cloned from hogan.js. periodt. π
π¦ VERSION π¦
version 2.05 β yeah bestie, she's on 2.05 πΈ
π DESCRIPTION π
okay so Text::Hogan is a statement-for-statement rewrite of hogan.js (that's http://twitter.github.io/hogan.js/) but in Perl. not a vibe-alike, not a "inspired by" β literally statement-for-statement. iconic behavior fr fr π
it's a mustache (https://mustache.github.io/) templating engine, and here's the part that makes her actually main character: she supports pre-compilation of your templates into pure Perl code, which then renders very quickly. compile once, zoom zoom forever. π₯
and she passes the full mustache spec (https://github.com/mustache/spec). all of it. no cap. π
π SYNOPSIS π
use Text::Hogan::Compiler;
my $text = "Hello, {{name}}!";
my $compiler = Text::Hogan::Compiler->new;
my $template = $compiler->compile($text);
say $template->render({ name => "Alex" });
likeβ¦β¦ look at her. four lines and you're rendering. π«Ά
if you want the full tea, go read Text::Hogan::Compiler and Text::Hogan::Template β they've got all the details.
π TEMPLATE FORMAT π
the template format is documented over in mustache(5) (https://mustache.github.io/mustache.5.html). that's the whole section, bestie, I'm not gonna gatekeep the spec from you when it's right there π
π SEE ALSO π
πΈ hogan.js
hogan.js (http://twitter.github.io/hogan.js/) is the original library that Text::Hogan is based on. she was written and is maintained by Twitter. she runs on Node.js and pre-compiles templates to pure JavaScript. the blueprint. the blueprintest. π«
π Text::Caml
Text::Caml supports searching for partials by file name, by default .caml β but that can be configured. customizable queen π
π¦ Template::Mustache
Template::Mustache is the one used by Dancer::Template::Mustache and Dancer2::Template::Mustache. she supports compile once, render many times, but β and this is the catch β she does not allow dumping the compiled form to disk. so close, bestie π
β Mustache::Simple
Mustache::Simple largely supports the Mustache spec, but skips the whitespace and decimal tests. (her behaviour with decimals is the same as Text::Hogan with the 'numeric_string_as_string' option enabled β noted! π) she also supports passing objects with getters to the context hash, so that {{name}} can be rendered from $object->name if $object->can('name') returns true. cute trick, ngl π
π AUTHORS π
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
a whole squad. a whole roster. we love a collaborative icon πβ¨
and that's a wrap, bestie π this was perl v5.40.1, dated 2026-07-31 β go compile something cute and make it render fast. slay, no cap, mwah ππ¦π
π¦ where this page comes from
- ubuntu stonking: libtext-hogan-perl 2.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms