Possible improvment
[email protected] ("John Washburn") Sun, 12 Apr 2009 22:36:00 -0500
| Newsgroups | perl.gedcom |
|---|---|
| Organization | John Washburn |
| Message-ID | <000c01c9bbe8$f9199560$eb4cc020$@org> |
Would the following additions to the Gedcom::Family package be prudent?
To the function add_wife()
$wife = $self->{gedcom}->get_individual($wife)
unless UNIVERSAL::isa($wife, "Gedcom::Individual");
# start of JWW addition code to enforce: sex of wife should be female
if (!defined($wife->get_value("sex")))
{
$wife->add("sex", "FEMALE");
}
carp "Wife, $wife->{xref}, is " . $wife->get_value("sex") . " instead of
FEMALE.\n"
if ($wife->get_value("sex") !~ /^(FEMALE|F)$/i);
$self->add("wife", $wife);
$wife->add("fams", $self->{xref});
Similarly in add_husband() add:
$husband = $self->{gedcom}->get_individual($husband)
unless UNIVERSAL::isa($husband, "Gedcom::Individual");
# start of JWW addition code to enforce: sex of husband should be male
if (!defined($husband->get_value("sex")))
{
$husband->add("sex", "MALE");
}
carp "Husband, $husband->{xref}, is " . $husband->get_value("sex") . "
instead of MALE.\n"
if ($husband->get_value("sex") !~ /^(MALE|M)$/i);
$self->add("husband", $husband);
$husband->add("fams", $self->{xref});