Re: [CDBI] Best way to tell if two objects are the same?

[prev] [thread] [next] [Date index for 2006/01/11]

From: Bill Moseley
Subject: Re: [CDBI] Best way to tell if two objects are the same?
Date: 18:50 on 11 Jan 2006
On Wed, Jan 11, 2006 at 06:18:28PM +0000, William Ross wrote:
> just calling id() should work for single-column keys, but with mcpk  
> you would need to call it in list context and compare the lists you  
> get back. The easier way to do essentially the same thing is to call  
> stringify_self() (in which case you can manage special cases by  
> defining a Stringify column set) or _live_object_key() (which also  
> includes the class name).

I need a general case so I'm not sure I can trust Stingify.  Object
can stringify to anything.  Also, _live_object_key is a newer method.

> 
> The overload does seem like a good idea. Maybe just:
> 
>   use overload 'cmp' => sub { $_[0]->_live_object_key cmp $_[1]- 
> >_live_object_key };

Yes, that would be a nice feature.  Not sure what I'd expect 'cmp',
'==' or 'eq', though.

Should this die?  Or it return false?  Or compare against what ever
the object is stringified to?

    if ( $cdbi_object eq 'constant' ) 

        -- 
        Bill Moseley
moseley@xxxx.xxx


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

Re: [CDBI] Best way to tell if two objects are the same?
Bill Moseley 18:50 on 11 Jan 2006

Generated at 09:31 on 23 Jan 2006 by mariachi v0.52