[dancer-users] Dancer2::Plugin::SendAs
John McDermott
jjm at jkintl.com
Tue Oct 27 18:33:53 GMT 2015
This looks cool.
What are the options for send_as? I have a dataset I send as JSON, but the
page that grabs it converts it to csv for the end user to load into a
spreadsheet. I would suppose YAML is an option for sending data, but are
there others such as CSV?
--john
On Tue, October 27, 2015 6:35 am, Russell Jenkins wrote:
> Fellow Dancers,
>
> At the Dancer conference in Vienna last week, Dancer2::Plugin::SendAs
> was developed
> and released. This plugin makes it easy to return either serialized
> content or HTML
> from a route. Here's the synopsis:
>
> use Dancer2;
> use Dancer2::Plugin::SendAs;
>
> set serializer => 'YAML';
> set template => 'template_toolkit';
>
> # returns HTML content, though YAML serializer is configured
> get '/html' => sub {
> send_as html => template 'foo';
> };
>
> # returns JSON content, even with YAML serializer configured
> get '/json/**' => sub {
> send_as json => splat; # JSON, not YAML!
> };
>
>
> Sawyer and I briefly discussed if this should be core functionality
> during the conference.
> We decided to release it as a plugin and review moving it to core if
> other Dancers find
> this functionality useful.
>
> Grab it from CPAN and give it a workout [1]. If send_as solves an issue
> for your apps or
> makes your code simpler, let us know (responding here if fine). If there
> is enough [2]
> feedback that this is generally useful, we'll make it core functionality.
>
> Happy dancing!
> Russell.
>
> [1] I'm doing some post-conference travel, so haven't used it in anger
> myself yet.
> [2] Don't ask me to quantify "enough" ;)
>
>
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
More information about the dancer-users
mailing list