| 1 | # Copyright 1998-2019, Paul Johnson (paul@pjcj.net) | ||||||||||
| 2 | |||||||||||
| 3 | # This software is free. It is licensed under the same terms as Perl itself. | ||||||||||
| 4 | |||||||||||
| 5 | # The latest version of this software should be available from my homepage: | ||||||||||
| 6 | # http://www.pjcj.net | ||||||||||
| 7 | |||||||||||
| 8 | # documentation at __END__ | ||||||||||
| 9 | |||||||||||
| 10 | 15 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 15 | require 5.005; | |||||||||
| 13 | |||||||||||
| 14 | package Gedcom::Family; | ||||||||||
| 15 | |||||||||||
| 16 | 15 | ▶ | use Gedcom::Record 1.21; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 15 | ▶ | use vars qw($VERSION @ISA); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 15 | $VERSION = "1.21"; | |||||||||
| 20 | 15 | @ISA = qw( Gedcom::Record ); | |||||||||
| 21 | |||||||||||
| 22 | sub husband { | ||||||||||
| 23 | 1878 | ▶ | my $self = shift; | ||||||||
|
Subroutine
husband: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 24 | 1878 | my @a = $self->resolve($self->tag_value("HUSB")); | |||||||||
| 25 | 1878 | ▶ | wantarray ? @a : $a[0] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | sub wife { | ||||||||||
| 29 | 1878 | ▶ | my $self = shift; | ||||||||
|
Subroutine
wife: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 30 | 1878 | my @a = $self->resolve($self->tag_value("WIFE")); | |||||||||
| 31 | 1878 | ▶ | wantarray ? @a : $a[0] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | sub parents { | ||||||||||
| 35 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
parents: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 36 | 0 | ($self->husband, $self->wife) | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub number_of_children { | ||||||||||
| 40 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
number_of_children: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 41 | 0 | my $nchi = $self->tag_value("NCHI"); | |||||||||
| 42 | 0 | ▶ | defined $nchi ? $nchi : ($#{[$self->children]} + 1) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub children { | ||||||||||
| 46 | 1811 | ▶ | my $self = shift; | ||||||||
|
Subroutine
children: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 47 | 1811 | my @a = $self->resolve($self->tag_value("CHIL")); | |||||||||
| 48 | 1811 | ▶ | wantarray ? @a : $a[0] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | sub boys { | ||||||||||
| 52 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
boys: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 53 | 0 | my @a = grep { $_->tag_value("SEX") !~ /^F/i } $self->children; | |||||||||
| 54 | 0 | ▶ | wantarray ? @a : $a[0] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | sub girls { | ||||||||||
| 58 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
girls: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 59 | 0 | my @a = grep { $_->tag_value("SEX") !~ /^M/i } $self->children; | |||||||||
| 60 | 0 | ▶ | wantarray ? @a : $a[0] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | sub add_husband { | ||||||||||
| 64 | 1 | ▶ | my $self = shift; | ||||||||
|
Subroutine
add_husband: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 65 | 1 | my ($husband) = @_; | |||||||||
| 66 | 1 | ▶ | $husband = $self->{gedcom}->get_individual($husband) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | unless UNIVERSAL::isa($husband, "Gedcom::Individual"); | ||||||||||
| 68 | 1 | $self->add("husband", $husband); | |||||||||
| 69 | 1 | $husband->add("fams", $self->{xref}); | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | sub add_wife { | ||||||||||
| 73 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
add_wife: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 74 | 2 | my ($wife) = @_; | |||||||||
| 75 | 2 | ▶ | $wife = $self->{gedcom}->get_individual($wife) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | unless UNIVERSAL::isa($wife, "Gedcom::Individual"); | ||||||||||
| 77 | 2 | $self->add("wife", $wife); | |||||||||
| 78 | 2 | $wife->add("fams", $self->{xref}); | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | sub add_child { | ||||||||||
| 82 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
add_child: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 83 | 2 | my ($child) = @_; | |||||||||
| 84 | 2 | ▶ | $child = $self->{gedcom}->get_individual($child) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 85 | unless UNIVERSAL::isa($child, "Gedcom::Individual"); | ||||||||||
| 86 | 2 | $self->add("child", $child); | |||||||||
| 87 | 2 | $child->add("famc", $self->{xref}); | |||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | sub print { | ||||||||||
| 91 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
print: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 92 | 0 | ▶ | $self->_items if shift; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 93 | 0 | $self->SUPER::print; $_->print for @{$self->{items}}; | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 15 | 1; | |||||||||
| 97 | |||||||||||
| 98 | __END__ | ||||||||||