On 1/12/06 2:42 PM, "Cees Hek" <[EMAIL PROTECTED]> wrote:

> On 1/12/06, Sean Davis <[EMAIL PROTECTED]> wrote:
>> Cannot load ApacheAdmin::Model::User without a primary key (username) with a
>> non-null value or another unique key with at least one non-null value. at
>> test.pl line 9
>> 
>> If I remove the inheritance from Catalyst::Model, everything works fine.
>> It's not too big a deal in practice--I don't NEED the catalyst::model
>> inheritance--but I'm curious why this doesn't work.
> 
> <SNIP>
> 
>> our @ISA = qw(Catalyst::Model Rose::DB::Object);
> 
> You are probably running into multiple inheritance problems.  Did you
> try reversing the order of those modules in @ISA to see if you get the
> same problem?
> 
> Catalyst::Model inherits from Catalyst::Component, which inherits from
> Class::Accessor::Fast and Class::Data::Inheritable.  So if there is a
> duplicated method that exists in Rose::DB::Object that also exists in
> one of those modules, then your Rose::DB::Object instance will end up
> calling the wrong method.  perl uses a depth first search to find
> method names when using multiple inheritance, so anything in the
> Catalyst::Model tree will take precidence over the methods in
> Rose::DB::Object.
> 
> Catalyst uses 'NEXT' to forward calls in a lot of places, so some of
> the method name conflicts 'may' still work, but any method that
> doesn't use NEXT means the real Rose::DB::Object method will never be
> called.

Thanks, Cees.  In the meantime, I have heard from Matt Trout.

I thought about the NEXT call (and even tried to modify the code to use
NEXT, unsuccessfully), but I hadn't thought of the obvious point that Matt
brought to my attention.  When Catalyst starts, it calls "new" on all its
components.  Since the module was technically a catalyst component by
including Catalyst::Model in the @ISA, it was calling "new" on the
Rose::DB::Object, which is what is generating the error.  Multiple
inheritance is pretty cool, but I see how it can become a problem if one
doesn't know exactly what is going on.

Sean




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to