blib/lib/Gedcom/Family.pm

filter: Statementstmt 66.0% 37 / 56 Branchbran 30.0% 6 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 64.2% 9 / 14 Podpod 18.1% 2 / 11 totaltotal 53.4% 54 / 101 CC 12 SCAR 14.0
CC
12
Cov
57%
print
12.0
number_of_children
6.0
boys
6.0
CRAP 4.1
« blib/lib/Gedcom/CGI.pm ↑ Summary blib/lib/Gedcom/Grammar_5_5_1.pm »
1 # Copyright 1998-2013, 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.20;
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.20";
20 15 @ISA = qw( Gedcom::Record );
21  
22 sub husband {
23 1788 ▶ my $self = shift;
Subroutine husband: called CC=2 SCAR=7.1
Pod undocumented
24 1788 my @a = $self->resolve($self->tag_value("HUSB"));
25 1788 ▶ wantarray ? @a : $a[0]
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 1788 0 1788
26 }
27  
28 sub wife {
29 1788 ▶ my $self = shift;
Subroutine wife: called CC=2 SCAR=7.1
Pod undocumented
30 1788 my @a = $self->resolve($self->tag_value("WIFE"));
31 1788 ▶ wantarray ? @a : $a[0]
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 1788 0 1788
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
BranchTrueFalseTotal
defined $nchi ? : 0 0 0
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
BranchTrueFalseTotal
wantarray ? : 1811 0 1811
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
BranchTrueFalseTotal
wantarray ? : 0 0 0
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
BranchTrueFalseTotal
wantarray ? : 0 0 0
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
BranchTrueFalseTotal
unless UNIVERSAL::isa($husband, "Gedcom::Individual") 0 1 1
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
BranchTrueFalseTotal
unless UNIVERSAL::isa($wife, "Gedcom::Individual") 0 2 2
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
BranchTrueFalseTotal
unless UNIVERSAL::isa($child, "Gedcom::Individual") 0 2 2
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
BranchTrueFalseTotal
if shift() 0 0 0
93 0 $self->SUPER::print; $_->print for @{$self->{items}};
94 }
95  
96 15 1;
97  
98 __END__
« blib/lib/Gedcom/CGI.pm ↑ Summary blib/lib/Gedcom/Grammar_5_5_1.pm »