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

Jérôme Etévé jerome.eteve at gmail.com
Tue Nov 2 10:04:45 GMT 2010


Hi,

I've got a catalyst specific model class that I'd like to instanciate
by wrapping it with the help of a Catalyst::Model::Adaptor

package MyClass;
use Moose;
has 'c' => ( is => 'ro' , isa => 'Catalyst' );
1;

package MyAPP::Model::MyClass
use base 'Catalyst::Model::Adaptor';
sub prepare_arguments {
        my ($self, $app) = @_; # $app sometimes written as $c
        return { c => $app };
}
1;

The problem is that here $app is not an instance of MyAPP, but just
the class name 'MyApp' .

How do I access the instance of MyApp from this method?

Cheers!

Jerome.


-- 
Jerome Eteve.
http://www.eteve.net
jerome at eteve.net



More information about the Catalyst mailing list