<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Fellow Dancers,<br>
<br>
At the Dancer conference in Vienna last week,
Dancer2::Plugin::SendAs was developed<br>
and released. This plugin makes it easy to return either serialized
content or HTML<br>
from a route. Here's the synopsis:<br>
<br>
<meta charset="utf-8">
use Dancer2;<br>
use Dancer2::Plugin::SendAs;<br>
<br>
set serializer => 'YAML';<br>
set template => 'template_toolkit';<br>
<br>
# returns HTML content, though YAML serializer is configured<br>
get '/html' => sub {<br>
send_as html => template 'foo';<br>
};<br>
<br>
# returns JSON content, even with YAML serializer configured<br>
get '/json/**' => sub {<br>
send_as json => splat; # JSON, not YAML!<br>
};<br>
<br>
<br>
Sawyer and I briefly discussed if this should be core functionality
during the conference.<br>
We decided to release it as a plugin and review moving it to core if
other Dancers find<br>
this functionality useful.<br>
<br>
Grab it from CPAN and give it a workout [1]. If send_as solves an
issue for your apps or<br>
makes your code simpler, let us know (responding here if fine). If
there is enough [2]<br>
feedback that this is generally useful, we'll make it core
functionality.<br>
<br>
Happy dancing!<br>
Russell.<br>
<br>
[1] I'm doing some post-conference travel, so haven't used it in
anger myself yet.<br>
[2] Don't ask me to quantify "enough" ;)<br>
<br>
<br>
<br>
</body>
</html>