#!/usr/bin/env perl
use Mojolicious::Lite;
plugin 'HTMLTemplateProRenderer';
get '/' => sub {
my $c = shift;
return $c->render(
'hi',
t1 => 'the first t1',
);
};
my $paths = app->renderer->paths;
unshift @$paths, 'exists';
app->start;
__DATA__
@@ hi.html.tmpl
<p> from __DATA__ its @@ hi.html.tmpl
<p> <TMPL_VAR NAME="t1">
$ perl foo.pl get /
[Tue Feb 14 19:24:14 2017] [debug] GET "/"
[Tue Feb 14 19:24:14 2017] [debug] Routing to a callback
[Tue Feb 14 19:24:14 2017] [debug] 200 OK (0.00174s, 574.713/s)
<p> from __DATA__ its @@ hi.html.tmpl
<p> the first t1
$ mv not_templates templates
$ perl foo.pl get /
[Tue Feb 14 19:24:27 2017] [debug] GET "/"
[Tue Feb 14 19:24:27 2017] [debug] Routing to a callback
[Tue Feb 14 19:24:27 2017] [debug] 200 OK (0.001793s, 557.724/s)
<p> from templates its hi.html.tmpl
<p>the first t1
$ mv not_exists exists
$ perl foo.pl get /
[Tue Feb 14 19:24:53 2017] [debug] GET "/"
[Tue Feb 14 19:24:53 2017] [debug] Routing to a callback
[Tue Feb 14 19:24:53 2017] [debug] 200 OK (0.001772s, 564.334/s)
<p> from exists its hi.html.tmpl
<p> the first t1
|