[Catalyst] Picking template type based on input

J. Shirley jshirley at gmail.com
Fri Mar 26 17:03:43 GMT 2010


On Fri, Mar 26, 2010 at 9:31 AM, Jon mailinglists <jon.mlist at gmail.com> wrote:
> On Fri, Mar 26, 2010 at 1:50 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:
>> Jon mailinglists wrote:
>>>
>>> Hi all,
>>> [snip]
>>
>> How is generating JSON in template toolkit not 100% insane?
>>
>> Please use something like Catalyst::View::JSON instead?
>>
>
> To be honest I haven't tried it but seeing you're involved in it I
> understand that stance :)
>
> I don't think Catalyst::View::JSON would help me though since I need
> to send "YUI JSON", ie:
> MyNamespace.callback({"ResultSet":{
>

That's not "YUI JSON", that's just a JSON callback which
Catalyst::View::JSON supports just fine (see the CONFIG section of the
Catalyst::View::JSON docs).


> Which would force me to do make changes in the result anyway, and a
> few loops in a tt2 file isn't that much of a problem.
>

I use JSON callbacks frequently, with YUI, and find that decorating
the resulting hash with pagination and then using
DBIx::Class::ResultClass::HashRefInflator everything works remarkably
well, without any munging.


-J



More information about the Catalyst mailing list