Think about Loose Coupling | |
PerlMonks |
How to add TO_JSON base method for DBIC Result in Catalystby Solo (Deacon) |
on Aug 20, 2011 at 15:16 UTC ( [id://921416]=perlquestion: print w/replies, xml ) | Need Help?? |
Solo has asked for the wisdom of the Perl Monks concerning the following question: It's difficult for me to title this question, because I'm not sure which Catalyst magic I'm breaking. I'm new to Catalyst and Moose and lost in all the pod. I'm trying to add generic JSON support to a Catalyst model. To do so, I add a TO_JSON object to my result class(es):
and extend Catalyst::View::JSON with some code I found. (I've stumbled on different approaches since--opinions on best approach for this also welcomed):
This works for each result class individually, but I'd like it to be DRYer. So, I think to create a result base class and extend that for my result classes...
Catalyst doesn't like this approach, yet, and I'm having a hard time figuring out which doc to read. Do I just need to tell Catalyst to ignore the '...::Base' class when loading namespaces (or whatever)? Or should I be doing this some other way entirely? --Solo
Back to
Seekers of Perl Wisdom
|
|