16 Aug
2016
16 Aug
'16
12:59 p.m.
On 08/15/2016 09:38 PM, Hagop "Jack" Bilemjian wrote:
sub BUILD { my $plugin = shift; my $app = $plugin->app;
$plugin->app->add_route( method => 'get', regexp => qr!/mypagel!, code => \&myfuncl, );
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 to call the serialozer from the app like $app->to_json? What is recommended?
Thanks,
Jack
Hello Jack, there is a simple answer in the manual: https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#send_as Regards Racke -- Ecommerce and Linux consulting + Perl and web application programming.