Hi all,
I'm making a small catalyst application and I want to be able to serve
different types of content based on parameters and/or request headers.
I'm curious about where the "correct" location for that kind of code
is, my current sollution is in the Root end like this:
sub end : ActionClass('RenderView') {
...
if ($c->stash->{json} || $c->request->params->{json} ||
$c->req->header('accept') =~ /json/)
{
$c->stash->{template} = $c->action.'_json.tt';
$c->res->headers->content_type( 'Application/json; charset=utf-8' );
}
...
}
but it feels "wrong" to put it in the Root controller rather than the
view. Is this really the place where I'm supposed to have that kind
of logic? Would that also be the place if I want to add pdf out to
pick another View to forward to?
Thanks in advance
Jon
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/