Re: Need help using Gedcom.pm

[email protected] (Ron Savage) Sun, 7 May 2017 10:56:03 +1000
Newsgroups perl.gedcom
Message-ID <[email protected]>
Hi Jutta

See below.

On 06/05/17 00:57, Jutta Wrage wrote:
> Am 05.05.2017 um 13:47 schrieb Nigel Horne:
>
>>        my $surname;
>>        my $sex = get_value({ person => $self, value => 'sex' });
>>        if(defined($sex) && ($sex eq 'F')) {
>>            if(my $husband = $self->husband()) {
>>                $surname = $husband->surname();
>>                $has_maiden_name = 1;
>>            } elsif(my $spouse = $self->spouse()) {
>>                if($opts{'f'}) {
>>                    die 'married, but no husband relationship';
>>                }
>>                if($opts{'w'}) {
>>                    red_warning({ person => $self, warning => 'married, but no husband relationship' });
>>                }
>>                $surname = $spouse->surname();
>>                $has_maiden_name = 1;
>>            }
>>        }
>
> This does not work for me. Too many errors.
>
> I have this code snippet included for testing purposes now:
>
> my $surname;
> if(my $husband = $i->husband()) {
>    $surname = $husband->get_value(["name", 1], "surn");
> }  else {
>    $surname = "";
> }
>
> I get a surname now for married people there. But if there are more than one partners it is always the very first one taken there, it seems, even if a loose partnership without marriage.

I suspect the reason you get 1 is that you have my $husband in scalar 
context. Try storing the return value in an array and see if you get the 
others.

> For example Anna Fehrs has three partners
> 1. Schadendorf - father of the first child only - no marriage
> 2. Hüttmann - he died and left additional children to her - marriage
> 3. Thomsen - some more children - marriage
>
> As "surname" I get Schadendorf, which never has been her name.
>
> And even if I want to add a list of names there for all partners, I do not hnow how to get all ob them.
> What bores me: she has a name, wen born, and she has another name to search for death records.
> My list is used as a working table to see which records from church books and "Standesamt" I still need to get.
>
> If I cannot get a list of all of her surnames (Name fields) from the gedcom export: Maybe I can get a list of her husbands using get_record or something like that?
>
> If that matters: Gedcom file is VERS 5.5.1.
>
>
> Regards,
>
> Jutta
>
>

-- 
Ron Savage - savage.net.au