[CDBI] Re: uniqueness of objects in memory??

Phil Mitchell phil at 2people.org
Mon Oct 24 23:07:18 BST 2005


On 10/24/05, Phil Mitchell <phil at 2people.org> wrote:
> On 10/24/05, Bill Moseley <moseley at hank.org> wrote:
> > On Mon, Oct 24, 2005 at 01:31:44PM -0700, Phil Mitchell wrote:
> > > [% prefs.home_page %]
> > > [% user.prefs.home_page %]
> > >
> > > and they're different.
> >
> > Can you demonstrate with just your model?  Something like:
> >
> >
> > > 1. User has_a Prefs object; User->Prefs->home_page equals X
> >
> >     my $user = User->retrieve(1);
> >     print "start home page ", $user->Prefs->home_page;
> >
> > > 2. Prefs gets updated with new data; Prefs->home_page equals Y
> >
> >     my $prefs = $user->Prefs;
> >     $prefs->home_page('Y');
> >     $prefs->update;
> >     print "From Prefs: ", $prefs->home_page;
> >
> >
> > > 3. But User->Prefs->home_page still equals X.
> >
> >     print "From user: ", $user->Prefs->home_page;
>
> Yeah, that's a good point. I apologize for not trying this sooner.
> When I run this in a Test::More script I don't see the problem. What
> the heck does that mean? That there's an interaction with catalyst?
>
> I'll delve some more and report back if I find anything... Thanks for
> all your suggestions!

OTOH, I can run essentially the same code inside a single template
inside my app:

[% prefs.home_page %]<br>  => X
[% user.prefs.home_page %]<br>  => X

[% prefs.home_page('Y') %]<br>
[% prefs.update() %]<br>

[% prefs.home_page %]<br>  => Y
[% user.prefs.home_page %]<br> => X

...and see the weird behavior.

>
> >
> > --
> > Bill Moseley
> > moseley at hank.org
> >
> >
> > _______________________________________________
> > ClassDBI mailing list
> > ClassDBI at lists.digitalcraftsmen.net
> > http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
> >
>
>
> --
> ==========================
> 2People Blog: http://2-people.blogspot.com/
> 2People site: http://www.2people.org
>


--
==========================
2People Blog: http://2-people.blogspot.com/
2People site: http://www.2people.org




More information about the ClassDBI mailing list