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

Bill Moseley moseley at hank.org
Wed Jan 11 14:29:08 GMT 2006


I need to know if $obj1 eq $obj2, and I'm wondering the best way.  I
suppose ref($obj1) eq ref($obj2) would fail without Live_Object index.

I notice the CDBI does this for the Live_Object index to build a key
for an object:

        my @primary_columns = $class->primary_columns;
        if (@primary_columns == grep defined, @{$data}{@primary_columns}) {

                # create single unique key for this object
                $obj_key = join "|", $class, map { $_ . '=' . $data->{$_} }
                        sort @primary_columns;
        }





-- 
Bill Moseley
moseley at hank.org





More information about the ClassDBI mailing list