Re: Factory

[prev] [thread] [next] [Date index for 2005/04/14]

From: William Ross
Subject: Re: Factory
Date: 10:47 on 14 Apr 2005
On 13 Apr 2005, at 17:10, Barry Dancis wrote:

> <snip>=A0
> =A0=A0 $rebase->use_classes (qw/Enzyme EnzymeSite Site/);
> =A0 my $enzyme =3D $rebase->retrieve('enzyme', name =3D> 'EcoRI');

that will only work if 'name' is your primary key, btw, but it wouldn't=20=

generate the error you saw.

> <snip>=A0
> Why does $rebase find the values and $self does not?
>  =A0
> I did notice that $rebase and $self have different timestamps=20
> indicating that they are different instances. The $self instance first=20=

> appears in CDF::dbh. It that what=A0 is supposed to happen?

that's a very good catch.
It's a bug, and it's there because I didn't test properly outside a=20
persistent context. Sorry.

I changed CDF recently so that when it loads a data class it drops=20
three methods in the package. One of them is factory() *, which returns=20=

the 'locally active factory object'. ie it calls=20
${factory_class}->instance(). The trouble is that a factory previously=20=

created by calling new() doesn't get held as an instance. There used to=20=

be a good reason for that but I don't think there is any more, so I've=20=

fixed it in the release which is about to go up (with handler versions=20=

for mod_perls 1 and 2, though god help anyone who's trying to use=20
mod_perl2 at the moment).

Meanwhile, to make your code work with 0.991, you just need to get your=20=

factory from instance in the first place:

	my $rebase =3D Class::DBI::Factory->instance();

and CDF will default to singleton construction as it should have done=20
in the first place.

best

will


* I've changed that to _factory(), btw.


> =A0
> TIA,
> =A0
> Barry

Factory
Barry Dancis 16:10 on 13 Apr 2005

Re: Factory
William Ross 10:47 on 14 Apr 2005

Re: Factory
Barry Dancis 15:43 on 14 Apr 2005

Generated at 12:49 on 16 Apr 2005 by mariachi v0.52