[Catalyst] How to access current MyApp instance ?

Tobias Kremer list at funkreich.de
Sat Jun 30 17:58:00 GMT 2007


> Hi.
> I want to call ->uri_for from my DBIC sources, but it is object  
> method, so MyApp->uri_for doesn't work.
> How do I access current catalyst object ($c)?

Why would you want to do that? Your schema/model shouldn't know about  
URIs.

If you really need to, you could use the ACCEPT_CONTEXT workaround to  
make $c available to your model:

http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/ 
Intro.pod#ACCEPT_CONTEXT

There are quite a few threads on the list dealing with accessing $c  
from the model. The search is your friend.

--Tobias






More information about the Catalyst mailing list