[Catalyst] How to access the real App in prepare_arguments in Catalyst::Model::Adaptor

Eden Cardim edencardim at gmail.com
Tue Nov 2 12:09:42 GMT 2010


>>>>> "Jérôme" == Jérôme Etévé <jerome.eteve at gmail.com> writes:

    Jérôme> The problem is that here $app is not an instance of MyAPP,
    Jérôme> but just the class name 'MyApp' .

    Jérôme> How do I access the instance of MyApp from this method?

There is no such thing as "the instance of MyApp", all of the intrinsic
state of the application is accessible via the class. The instantes
represent a specific request/response cycle. So if you want to hold onto
an instance, you need to rebuild the entire containing object for each
instance as well. Also, you want to weaken the attribute or it'll leak
memory. 

-- 
   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://blog.edencardim.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list