line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
11
|
|
|
11
|
|
71
|
use strict; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
450
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require 5.005; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package Gedcom::Family; |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
11
|
|
56
|
use Gedcom::Record 1.21; |
|
11
|
|
|
|
|
142
|
|
|
11
|
|
|
|
|
227
|
|
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
11
|
|
47
|
use vars qw($VERSION @ISA); |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
6256
|
|
19
|
|
|
|
|
|
|
$VERSION = "1.21"; |
20
|
|
|
|
|
|
|
@ISA = qw( Gedcom::Record ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub husband { |
23
|
1878
|
|
|
1878
|
0
|
2132
|
my $self = shift; |
24
|
1878
|
|
|
|
|
2920
|
my @a = $self->resolve($self->tag_value("HUSB")); |
25
|
1878
|
50
|
|
|
|
4063
|
wantarray ? @a : $a[0] |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub wife { |
29
|
1878
|
|
|
1878
|
0
|
2180
|
my $self = shift; |
30
|
1878
|
|
|
|
|
2975
|
my @a = $self->resolve($self->tag_value("WIFE")); |
31
|
1878
|
50
|
|
|
|
4065
|
wantarray ? @a : $a[0] |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub parents { |
35
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
36
|
0
|
|
|
|
|
0
|
($self->husband, $self->wife) |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub number_of_children { |
40
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
41
|
0
|
|
|
|
|
0
|
my $nchi = $self->tag_value("NCHI"); |
42
|
0
|
0
|
|
|
|
0
|
defined $nchi ? $nchi : ($#{[$self->children]} + 1) |
|
0
|
|
|
|
|
0
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub children { |
46
|
1764
|
|
|
1764
|
0
|
1982
|
my $self = shift; |
47
|
1764
|
|
|
|
|
2808
|
my @a = $self->resolve($self->tag_value("CHIL")); |
48
|
1764
|
50
|
|
|
|
4220
|
wantarray ? @a : $a[0] |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub boys { |
52
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
53
|
0
|
|
|
|
|
0
|
my @a = grep { $_->tag_value("SEX") !~ /^F/i } $self->children; |
|
0
|
|
|
|
|
0
|
|
54
|
0
|
0
|
|
|
|
0
|
wantarray ? @a : $a[0] |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub girls { |
58
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
59
|
0
|
|
|
|
|
0
|
my @a = grep { $_->tag_value("SEX") !~ /^M/i } $self->children; |
|
0
|
|
|
|
|
0
|
|
60
|
0
|
0
|
|
|
|
0
|
wantarray ? @a : $a[0] |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub add_husband { |
64
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
65
|
1
|
|
|
|
|
3
|
my ($husband) = @_; |
66
|
1
|
50
|
|
|
|
5
|
$husband = $self->{gedcom}->get_individual($husband) |
67
|
|
|
|
|
|
|
unless UNIVERSAL::isa($husband, "Gedcom::Individual"); |
68
|
1
|
|
|
|
|
9
|
$self->add("husband", $husband); |
69
|
1
|
|
|
|
|
4
|
$husband->add("fams", $self->{xref}); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub add_wife { |
73
|
2
|
|
|
2
|
0
|
8
|
my $self = shift; |
74
|
2
|
|
|
|
|
4
|
my ($wife) = @_; |
75
|
2
|
50
|
|
|
|
9
|
$wife = $self->{gedcom}->get_individual($wife) |
76
|
|
|
|
|
|
|
unless UNIVERSAL::isa($wife, "Gedcom::Individual"); |
77
|
2
|
|
|
|
|
6
|
$self->add("wife", $wife); |
78
|
2
|
|
|
|
|
5
|
$wife->add("fams", $self->{xref}); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub add_child { |
82
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
83
|
2
|
|
|
|
|
5
|
my ($child) = @_; |
84
|
2
|
50
|
|
|
|
16
|
$child = $self->{gedcom}->get_individual($child) |
85
|
|
|
|
|
|
|
unless UNIVERSAL::isa($child, "Gedcom::Individual"); |
86
|
2
|
|
|
|
|
8
|
$self->add("child", $child); |
87
|
2
|
|
|
|
|
5
|
$child->add("famc", $self->{xref}); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub print { |
91
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
92
|
0
|
0
|
|
|
|
|
$self->_items if shift; |
93
|
0
|
|
|
|
|
|
$self->SUPER::print; $_->print for @{$self->{items}}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |