DOKK / manpages / debian 10 / libtext-hogan-perl / Text::Hogan::Template.3pm.en
Text::Hogan::Template(3pm) User Contributed Perl Documentation Text::Hogan::Template(3pm)

Text::Hogan::Template - represent and render compiled templates

version 1.04

Use Text::Hogan::Compiler to create Template objects.

Then call render passing in a hashref for context.

    use Text::Hogan::Compiler;
    my $template = Text::Hogan::Compiler->new->compile("Hello, {{name}}!");
    say $template->render({ name => $_ }) for (qw(Fred Wilma Barney Betty));

Optionally takes a hashref of partials.

    use Text::Hogan::Compiler;
    my $template = Text::Hogan::Compiler->new->compile("{{>hello}}");
    say $template->render({ name => "Dino" }, { hello => "Hello, {{name}}!" });

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

Alex Balhatchet (alex@balhatchet.net)

2018-05-05 perl v5.26.2