[Catalyst] Re: [RDBO] Catalyst model
John Siracusa
siracusa at mindspring.com
Thu Jan 12 21:17:27 CET 2006
On 1/12/06, Sean Davis <sdavis2 at mail.nih.gov> 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.
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 your Rose::DB::Object objects to be one-per-app, so inheriting from
Catalyst::Model is not appropriate or sensible in this case.
-John
More information about the Catalyst
mailing list