Charlie Garrison wrote: > You're looking for ACCEPT_CONTEXT. Took me a while to get the right > setup so that it did what I needed but works great now. I couldn't > find *one* complete example that showed me how to best implement it, > but after looking at various examples I was able to pick out the bits > that worked for my app. I ended up with something very close to this > <http://article.gmane.org/gmane.comp.web.catalyst.general/11887>. > > Best practices say to only store the info from $context that you need > in your model rather than a reference to $context itself. IOW, if you > just need the current user object, then just store that. I don't > recall the reasoning for it though.
You can try mixing in Catalyst::Component::ACCEPT_CONTEXT. It will handle the ACCEPT_CONTEXT magic and provide $c as $self->context for you. The reason for not storing $context in your model is because it will create a circular reference if you're not careful. Catalyst::Component::ACCEPT_CONTEXT is careful, so you don't need to worry about that. :) Regards, Jonathan Rockway
signature.asc
Description: OpenPGP digital signature
_______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/