Don't ask to ask, just ask | |
PerlMonks |
Re: How to make a fingerprint from an Objectby Moron (Curate) |
on May 07, 2007 at 17:44 UTC ( [id://613993]=note: print w/replies, xml ) | Need Help?? |
You could use Digest::MD5 but that only operates on one string. In general, an object is a blessed reference to a compound data structure which doesn't automatically fit. So the real challenge is to figure out a unique way to convert the data structure to a single string that can be converted to MD5. Data::Dumper The only thing that occurs to me though is that fingerprinting the whole object shouldn't be necessary - it should be sufficient to fingerprint an ordered, delimited concatenation of selected instance fields. It is more usual (though not necessarily mandatory) for this to be the primary key in the logical data model rather than some bulk data field. Update: You could also consider storing the MD5 in the database, setting a UNIQUE constraint on some selection of fields and letting the database deal with the problem.
__________________________________________________________________________________
^M Free your mind!
In Section
Seekers of Perl Wisdom
|
|