<div dir="ltr">So i set up a quick instance and attempted the doc, i keep getting this:<div><pre class="error" style="font-family:"lucida console",monaco,"andale mono","bitstream vera sans mono",consolas,monospace;font-size:12px;border-width:1px;border-style:solid;border-color:rgb(0,0,0) rgb(238,238,238) rgb(238,238,238) rgb(0,0,0);padding:1em;background:rgb(51,51,68);color:rgb(204,204,221);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">Unrecognized response type from route: Template::Stash::AutoEscaping::Escaped::HTML.</pre></div><div>Because its an extension i copied some of the subroutine for the _build_engine and so i have:</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(86,156,214)">my</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">$tt</span><span style="color:rgb(212,212,212)"> = Template</span><span style="color:rgb(212,212,212)">-></span><span style="color:rgb(212,212,212)">new({</span></div><div><span style="color:rgb(212,212,212)"> STASH </span><span style="color:rgb(212,212,212)">=></span><span style="color:rgb(212,212,212)"> Template::Stash::AutoEscaping</span><span style="color:rgb(212,212,212)">-></span><span style="color:rgb(212,212,212)">new,</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">%tt_config</span><span style="color:rgb(212,212,212)">,</span></div><div><span style="color:rgb(212,212,212)"> });</span></div></div><br></div><div>That stash kills it. The route doesnt like the return obviously but not sure how to fix it from there.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 22, 2018 at 12:01 PM, Lutz Gehlen <span dir="ltr"><<a href="mailto:lrg_ml@gmx.net" target="_blank">lrg_ml@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Scott, hey all,<br>
<br>
ok, here is what I did. I wrote a Dancer2::Template::MyApp module<br>
following the example in Dancer2::Template::<wbr>TemplateToolkit:<br>
<br>
----<br>
package Dancer2::Template::MyApp;<br>
use 5.014;<br>
<br>
use Moo;<br>
use Template::Stash::AutoEscaping;<br>
<br>
extends 'Dancer2::Template::<wbr>TemplateToolkit';<br>
<br>
<br>
around '_build_engine' => sub {<br>
my $orig = shift;<br>
my $self = shift;<br>
<br>
my $tt = $self->$orig(@_);<br>
<br>
# replace the stash object<br>
$tt->service->context->{STASH} = Template::Stash::AutoEscaping-<br>
>new(<br>
$self->config->{STASH}<br>
);<br>
<br>
return $tt;<br>
};<br>
<br>
<br>
1;<br>
----<br>
<br>
Then I adapted my config.yml<br>
<br>
----<br>
template: "MyApp"<br>
engines:<br>
template:<br>
MyApp:<br>
<span class=""> start_tag: '[%'<br>
end_tag: '%]'<br>
ENCODING: utf8<br>
</span> STASH:<br>
----<br>
<br>
If I try to call a route in my application, the route crashes with:<br>
Route exception: Failed to render template: undef error - Not a GLOB<br>
reference at /usr/local/lib/x86_64-linux-<br>
gnu/perl/5.20.2/Template/<wbr>Provider.pm line 618.<br>
<br>
If I comment out the replacement of the stash object it works<br>
(unsurprisingly).<br>
<br>
I have also tried to overload the entire build_engine method instead<br>
of using "around" in order to construct the Template object with the<br>
alternative stash object right away. This leads to the same result.<br>
<br>
I went to line 618 of Template::Provider and printed out the<br>
respective variable using Data::Dumper. It seems to be an arrayref<br>
blessed into Template::Stash::AutoEscaping:<wbr>:Escaped::HTML. However,<br>
Template::Provider obviously expects a GLOB reference.<br>
<br>
I'd be very thankful if someone could help me on with this. I am<br>
stuck.<br>
<span class=""><br>
Thank you and best wishes,<br>
Lutz<br>
<br>
<br>
</span><div><div class="h5">On Monday, 19.03.2018 19:07:19 Lutz Gehlen wrote:<br>
> Hey Scott,<br>
><br>
> sorry for the long silence. After my return I've tried to get this<br>
> solution to work, but so far I've not been successful. I wanted<br>
> to write up my attempts, but got buried in other work, hence the<br>
> delay. I'll reply in more detail later this week.<br>
><br>
> Cheers,<br>
> Lutz<br>
><br>
> On Tuesday, 13.03.2018 12:51:54 Scott H wrote:<br>
> > Did this work?<br>
> ><br>
> > On Wed, Feb 21, 2018 at 6:46 AM, Lutz Gehlen <<a href="mailto:lrg_ml@gmx.net">lrg_ml@gmx.net</a>><br>
><br>
> wrote:<br>
> > > Hi Scott,<br>
> > ><br>
> > > thank you for your reply. This looks exactly like the piece of<br>
> > > information I was lacking. I'll be traveling the next couple<br>
> > > of<br>
> > > days, but I'll certainly try this approach next week.<br>
> > ><br>
> > > Cheers,<br>
> > > Lutz<br>
> > ><br>
> > > On Tuesday, 20.02.2018 11:40:00 Scott H wrote:<br>
> > > > Looking into what your asking, have you tried this:<br>
> > > > <a href="https://metacpan.org/pod/Dancer2::Template::TemplateToolkit" rel="noreferrer" target="_blank">https://metacpan.org/pod/<wbr>Dancer2::Template::<wbr>TemplateToolkit</a><br>
> > > ><br>
> > > > Go to Advanced Customizations and you'll see how to create a<br>
> > > > subclass module to return $tt. Have you tried this method?<br>
> > > ><br>
> > > > -Scott<br>
> > > ><br>
> > > > On Tue, Feb 20, 2018 at 1:47 AM, Lutz Gehlen<br>
> > > > <<a href="mailto:lrg_ml@gmx.net">lrg_ml@gmx.net</a>><br>
<br>
</div></div>[...]<br>
<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/<wbr>mailman/listinfo/dancer-users</a><br>
</div></div></blockquote></div><br></div>