Re: gedcom diff
[email protected] ("Eugene van der Pijll")
| Newsgroups | perl.gedcom |
|---|---|
| Message-ID | <[email protected]> |
Ron Savage wrote:
> > From just looking at it right now, two obvious improvements that
> > are required are to compare actual dates rather than their textual
> > representations, and to match other textual records in a somewhat
> > finer graduation than 0% or 100%.
>
> I take it you mean, e.g., by instantiating some form of Date::* or
> DateTime::*
> type of object, thus delegating the comparison work to pre-existing code?
You mean a Gedcom::Date object? Gedcom::Date knows about all valid date
formats in the gedcom specification. I think a comparison of two dates would
look something like this:
$date1 = Gedcom::Date->parse( $indi1->birth->date );
$date2 = Gedcom::Date->parse( $indi2->birth->date );
if (not defined ($date1 < $date2)) {
# the order of date1 and date2 is undefined;
# they may refer to the same date
}
I thought that I had also added a consistent_with() method, but apparently,
I have not uploaded that version yet. I will, when I am home again.
Gedcom::Date is available from your nearest CPAN archive.
Eugene
--
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net