On 1/12/06, Sean Davis <[EMAIL PROTECTED]> wrote:
> 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.

Right, but not because you can't call new() on a
Rose::DB::Object-derived class without causing an error.  The problem
is that Rose::Object::new() never gets called (Rose::DB::Object isa
Rose::Object) and so the $user object never actually gets its username
set:

  $user = ApacheAdmin::Model::User->new(username => 'doron');
                                      # ^^^^^^^^^^^^^^^^^^^
                                      # This info is discarded

  $user->load(); # $user here is an empty blessed hash

Apparently the Catalyst trunk has a fix for this issue, but as Matt
pointed out on IRC, "a catalyst component is a per-app object."  You
probably don't want yout Rose::DB::Object objects to be one-per-app,
so inheriting from Catalyst::Model is not appropriate or sensible in
this case.

-John


-------------------------------------------------------
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_idv37&alloc_id865&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