<div dir="ltr">Hi Stefan,<div><br></div><div>Thank you very much.  That was helpful.  Here's the line I placed in my plugin to make it work:</div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">    $app->send_as( JSON => { anchor   => $myanchor,</font></div><div><font face="monospace, monospace">                             interval => $plugin->update_interval,</font></div><div><font face="monospace, monospace">                             text     => $output } );</font></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><br>Jack<br></div></div>
<br><div class="gmail_quote">On Tue, Aug 16, 2016 at 5:59 AM, Stefan Hornburg (Racke) <span dir="ltr"><<a href="mailto:racke@linuxia.de" target="_blank">racke@linuxia.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 08/15/2016 09:38 PM, Hagop "Jack" Bilemjian wrote:<br>
><br>
> sub BUILD {<br>
>   my $plugin = shift;<br>
>   my $app    = $plugin->app;<br>
><br>
>   $plugin->app->add_route(<br>
>     method => 'get',<br>
>     regexp => qr!/mypagel!,<br>
>     code   => \&myfuncl,<br>
>   );<br>
><br>
> Then, in sub myfunc {  I want to call to_json.  Right now, I'm doing a use JSON, and it works properly.  Is there a way<br>
> to call the serialozer from the app like $app->to_json?  What is recommended?<br>
><br>
> Thanks,<br>
><br>
> Jack<br>
<br>
Hello Jack,<br>
<br>
there is a simple answer in the manual:<br>
<br>
<a href="https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#send_as" rel="noreferrer" target="_blank">https://metacpan.org/pod/<wbr>distribution/Dancer2/lib/<wbr>Dancer2/Manual.pod#send_as</a><br>
<br>
Regards<br>
<span class="HOEnZb"><font color="#888888">        Racke<br>
<br>
--<br>
Ecommerce and Linux consulting + Perl and web application programming.<br>
<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>
</font></span></blockquote></div><br></div></div>