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::MustacheTemplate::Compiler - Simple mustache template compiler

SYNOPSIS

    use Text::MustacheTemplate::Lexer;
    use Text::MustacheTemplate::Parser;
    use Text::MustacheTemplate::Compiler;

    # change delimiters
    # local $Text::MustacheTemplate::Lexer::OPEN_DELIMITER = '<%';
    # local $Text::MustacheTemplate::Lexer::CLOSE_DELIMITER = '%>';

    my $source = '* {{variable}}';
    my @tokens = Text::MustacheTemplate::Lexer->tokenize();

    local $Text::MustacheTemplate::Parser::SOURCE = $source; # optional for syntax error reporting
    my $ast = Text::MustacheTemplate::Parser->parse(@tokens);

    my $template = Text::MustacheTemplate::Compiler->compile($ast);
    my $result = $template->({ variable => 'foo' });
    print "result: $result\n"; # print "* foo";

DESCRIPTION

Text::MustacheTemplate::Compiler is a compiler for Mustache tempalte.

This is low-level interface for Text::MustacheTemplate. The APIs may be change without notice.

METHODS

compile

LICENSE

Copyright (C) karupanerura.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

karupanerura <karupa@cpan.org>