[Catalyst] How to access current MyApp instance ?

Oleg Pronin syber.rus at gmail.com
Sun Jul 1 14:51:50 GMT 2007


Because [%Game.detailsHref%] or [%Game.historyHref%] is much easier and
faster to call then
[%INCLUDE game_hrefs game=3DGame type=3D'details'%]

As a temporary fast solution i use this:
in root controller's auto action:
MyApp->c($c);
weaken(MyApp->c);

from anywhere: $c =3D MyApp->c;


2007/6/30, Tobias Kremer <list at funkreich.de>:
>
> > 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
>
>
>
>
> _______________________________________________
> List: Catalyst at 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070701/8c011=
378/attachment.htm


More information about the Catalyst mailing list