Re: include pedigree information into program
[email protected] (Nigel Horne) Wed, 27 Sep 2017 18:10:08 -0400
| Newsgroups | perl.gedcom |
|---|---|
| Message-ID | <[email protected]> |
On 9/27/17 2:44 PM, Jutta Wrage wrote:
> Hi!
>
> I do not understand how to get access to the pedigree information for a=
child in a family.
>
> I have this in my code to print out the children in each family of a ce=
rtain person as starting point:
>
> (essentials here only)
>
> my @fams =3D $start->fams;
> my @fams =3D $start->fams;
> for my $fam (@fams)
> my @children =3D $fam->children;
> for my $child (@children) {
> print_person($child);
> }
> }
>
> print_person is a sub to print information about an individual.
>
> As the PEDI information is in the fam record it seems I have to add som=
ething in the code above.
>
> Could somebody give me a hint, please?
That should work, but it assumes one family per person.=C2=A0 Try this:
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 my @children;
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 foreach my $f($start->fams()) {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 @children =3D (=
@children, $f->children());
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 foreach my $child(@children) =
{
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 print_person($c=
hild);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
You may also wish to add this debugging statement:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 print 'I found ', scalar(@chi=
ldren), ' in the family of ',=20
print_person($start), "\n";
-Nigel
>
> Regards,
>
> Jutta
>
--=20
Nigel Horne
Conductor: Rockville Brass Band, Washington Metropolitan GSO
@nigelhorne | fb/nigel.horne | bandsman.co.uk | concert-bands.co.uk | www=
=2Enigelhorne.com
Unless it's for my eyes only, please use "reply all"