[dancer-users] Dancer2::Plugin::SendAs

Yanick Champoux yanick at babyl.dyndns.org
Wed Oct 28 13:59:08 GMT 2015

On 2015-10-27 02:28 PM, Alexis Sukrieh wrote:
> Also, given that D2 provides a clean scoping (thanks Apps!) it's not
> such a problem we're now stricter. If you want both, just put the
> serializers in an app and you're done.

Just to illustrate (as we are discussing something along those lines on
the dev side), that could look like:

	use 5.20.0;

	package MyApp::Templatey {
   		use Dancer2;

		set template => 'Simple';

		get '/templated' => sub { template "templated" };

	package MyApp::Serializish {
   		use Dancer2;

		set serializer => 'JSON';

		get '/serialized' => sub { $some_struct };

The final application will have the routes '/templated' and
'/serialized', and they will both act as per their names. The end-user
will never know, but for the developer the existence of both sub-apps
mean that the behaviours are nicely segregated.


More information about the dancer-users mailing list