The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

VERSION

version 0.07

SYNOPSIS

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}}!" });

Also optionally takes a string

NOTES

You can pass a subroutine reference as a value and things will happen or an exception will be thrown. This is half-implemented in this way because what hogan.js does and what the mustache spec says should happen are different. When they agree I will implement the feature.

COPYRIGHT

Copyright (C) 2015 Lokku Ltd.

AUTHOR

Statement-for-statement copied from hogan.js by Twitter!

Alex Balhatchet (alex@lokku.com)