How to turn off caching in Mojolicious::Renderer

Viewed 43

my_app.pl:

#!/usr/bin/perl

use strict;
use warnings;
use Mojolicious::Lite -signatures;

my $route = Mojolicious::Routes::Route->new;

sub foo($c) {
    $c->stash(one => 23);
    $c->render(template => 'magic', two => 24);
}

my $renderer = app->renderer;
# $renderer->cache(undef); <- ?
# Route to templates files
$renderer->paths(['/var/www/site/templates/']);

any '/foo' => \&foo;

app->start;

magic.html.ep:

The magic numbers are <%= $one %> and <%= $two %>!

Then run the application:

$ morbo my_app.pl

It works, but when I change the template it doesn't change the output because the template is cached:

Rendering template "magic.html.ep"
Rendering cached template "magic.html.ep"

How can I turn it off during development? I tried $renderer->cache(undef);, but it didn't work.

0 Answers
Related