blib/lib/Gedcom/LifeLines.pm

filter: Statementstmt 14.2% 79 / 556 Branchbran 6.9% 17 / 246 Conditioncond 6.7% 4 / 59 MC/DCmcdc 3.0% 1 / 33 Subroutinesub 13.3% 20 / 150 Podpod 0.0% 0 / 143 totaltotal 10.1% 121 / 1187 CC 156 SCAR 28.8
CC
156
Cov
12%
stddate
132.0
intersect
56.0
difference
56.0
CRAP 17.8
« blib/lib/Gedcom/Individual.pm ↑ Summary blib/lib/Gedcom/Record.pm »
1 # Copyright 1999-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 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 require 5.005;
13  
14 package Gedcom::LifeLines;
15  
16 3 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 BEGIN { # We'll use these if they are available
18 3 ▶ eval "use Date::Manip";
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶ eval "use Roman ()";
Subroutine BEGIN: called CC=1 SCAR=0.0
20 }
21  
22 3 ▶use Gedcom 1.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 ▶use vars qw($VERSION @ISA @EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 $VERSION = "1.20";
26 3 @ISA = qw( Exporter );
27 3 @EXPORT = qw (
28 set_ged display flush
29 name fullname surname givens trimname
30 birth death baptism burial
31 father mother nextsib prevsib
32 sex male female pn
33 nspouses nfamilies parents
34 title key soundex inode root
35 indi firstindi nextindi previndi
36 marriage husband wife nchildren firstchild lastchild fnode
37 fam firstfam nextfam prevfam
38 xref tag value parent child sibling
39 savenode
40 date place year long short gettoday
41 dayformat monthformat dateformat stddate
42 extractdate extractnames extractplaces extracttokens
43 getindi getindiset getfam getint getstr
44 getindimsg getintmsg getstrmsg
45 choosechild choosefam chooseindi choosesubset
46 menuchoose
47 lower upper capitalize trim rjustify
48 save strsave concat strconcat strlen
49 substring index
50 d card ord alpha roman
51 strsoundex
52 strtoint atoi
53 strcmp eqstr nestr
54 linemode pagemode col row pos pageout
55 nl sp qt
56 newfile outfile
57 copyfile print
58 addtoset deletefromset lengthset
59 union intersect difference
60 parentset childset spouseset siblingset
61 ancestorset descendentset descendantset
62 uniqueset namesort keysort valuesort
63 genindiset gengedcom
64 createnode addnode deletenode
65 reference dereference getrecord
66 lock unlock
67 database version
68 system
69 );
70  
71 3 my ($Day_format, $Month_format, $Date_format) = (0, 0, 0);
72 3 my ($Line_mode, $Rows, $Columns, $Row, $Column) = (1, 0, 0, 0, 0);
73 3 my ($Line, @Lines) = ("");
74  
75 3 my $Ged;
76  
77 sub set_ged {
78 3 ▶ $Ged = shift
Subroutine set_ged: called CC=1 SCAR=0.0
Pod undocumented
79 }
80  
81 sub display {
82 835 ▶ my ($text) = @_;
Subroutine display: called CC=5 SCAR=17.1
Pod undocumented
83 835 ▶ return unless defined $text && length $text;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text and length $text 439 396 835
Condition66%2/3
defined $text and length $text
!ll&&!rl&&r
4390396
MC/DC50%1/2
defined $text and length $text
defined $text length $text
Truth table66%2/3
A and B
A= defined $textB= length $text
ABresult
0X0
100
111
84 396 ▶ if ($Line_mode) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Line_mode) { } 396 0 396
85 396 $Line .= $text;
86 396 ▶ print $1 if $Line =~ s/^(.*\n)//s;
Branch: 1 branch
BranchTrueFalseTotal
if $Line =~ s/^(.*\n)//s 98 298 396
87 } else {
88 # print STDERR "$Row, $Column: <$text>\n";
89 0 $Lines[$Row] .= " " x ($Column - length $Lines[$Row]);
90 0 substr $Lines[$Row], $Column, length $text, $text;
91 0 $Column += length $text;
92 }
93 return
94 396 }
95  
96 sub flush {
97 3 ▶ if ($Line_mode) {
Subroutine flush: called CC=2 SCAR=7.4
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if ($Line_mode) { } 3 0 3
98 3 print $Line;
99 3 $Line = "";
100 } else {
101 0 pageout();
102 }
103 return
104 3 }
105  
106 sub name {
107 0 ▶ my ($indi, $cased) = @_;
Subroutine name: not called CC=4 SCAR=30.0
Pod undocumented
108 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
109 0 ▶ my $name = !defined $cased || $cased ? $indi->cased_name : $indi->name;
Branch: 1 branch
BranchTrueFalseTotal
!defined($cased) || $cased ? : 0 0 0
Condition0%0/3
not defined $cased or $cased
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $cased or $cased
not defined $cased $cased
Truth table0%0/3
not(A) or B
A= not defined $casedB= $cased
ABresult
1X1
011
000
110 0 $name =~ s|/||g;
111 0 $name
112 }
113  
114 sub fullname {
115 0 ▶ my ($indi, $cased, $inorder, $length) = @_;
Subroutine fullname: not called CC=5 SCAR=34.0
Pod undocumented
116 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
117 0 ▶ my $name = $inorder
Branch: 2 branches
BranchTrueFalseTotal
$inorder ? : 0 0 0
$cased ? : 0 0 0
118 ? name($indi, $cased)
119 : ($cased ? uc $indi->surname : $indi->surname) . ", "
120 . $indi->given_names;
121 0 ▶ $name = substr $name, 0, $length if defined $length;
Branch: 1 branch
BranchTrueFalseTotal
if defined $length 0 0 0
122 0 $name
123 }
124  
125 sub surname {
126 0 ▶ my ($indi) = @_;
Subroutine surname: not called CC=2 SCAR=17.9
Pod undocumented
127 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
128 0 $indi->surname
129 }
130  
131 sub givens {
132 0 ▶ my ($indi) = @_;
Subroutine givens: not called CC=2 SCAR=17.9
Pod undocumented
133 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
134 0 $indi->given_names
135 }
136  
137 sub trimname {
138 0 ▶ my ($indi, $length) = @_;
Subroutine trimname: not called CC=2 SCAR=17.9
Pod undocumented
139 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
140 0 substr $indi->name, 0, $length
141 }
142  
143 sub birth {
144 0 ▶ my ($indi) = @_;
Subroutine birth: not called CC=2 SCAR=17.9
Pod undocumented
145 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
146 0 $indi->tag_record("BIRT")
147 }
148  
149 sub death {
150 0 ▶ my ($indi) = @_;
Subroutine death: not called CC=2 SCAR=17.9
Pod undocumented
151 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
152 0 $indi->tag_record("DEAT")
153 }
154  
155 sub baptism {
156 0 ▶ my ($indi) = @_;
Subroutine baptism: not called CC=5 SCAR=34.0
Pod undocumented
157 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
158 0 ▶ $indi->tag_record("BAPM") ||
Branch: 1 branch
BranchTrueFalseTotal
$indi->tag_record("BAPM") or $indi->tag_record("BAPL") or $indi->tag_record("CHR") or $indi->tag_record("CHRA") 0 0 0
Condition0%0/6
$indi->tag_record("BAPM") or $indi->tag_record("BAPL") or $indi->tag_record("CHR")
l!l&&r!l&&!r
000
$indi->tag_record("BAPM") or $indi->tag_record("BAPL")
l!l&&r!l&&!r
000
MC/DC0%0/3
$indi->tag_record("BAPM") or $indi->tag_record("BAPL") or $indi->tag_record("CHR")
$indi->tag_record("BAPM") $indi->tag_record("BAPL") $indi->tag_record("CHR")
Truth table0%0/4
A or B or C
A= $indi->tag_record("BAPM")B= $indi->tag_record("BAPL")C= $indi->tag_record("CHR")
ABCresult
1XX1
01X1
0011
0000
159 $indi->tag_record("BAPL") ||
160 $indi->tag_record("CHR") ||
161 $indi->tag_record("CHRA")
162 }
163  
164 sub burial {
165 0 ▶ my ($indi) = @_;
Subroutine burial: not called CC=2 SCAR=17.9
Pod undocumented
166 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
167 0 $indi->tag_record("BURI")
168 }
169  
170 sub father {
171 0 ▶ my ($indi) = @_;
Subroutine father: not called CC=2 SCAR=17.9
Pod undocumented
172 0 ▶ return undef unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
173 0 scalar $indi->father
174 }
175  
176 sub mother {
177 0 ▶ my ($indi) = @_;
Subroutine mother: not called CC=2 SCAR=17.9
Pod undocumented
178 0 ▶ return undef unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
179 0 scalar $indi->mother
180 }
181  
182 sub nextsib {
183 0 ▶ my ($indi) = @_;
Subroutine nextsib: not called CC=2 SCAR=17.9
Pod undocumented
184 0 ▶ return undef unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
185 0 scalar $indi->younger_siblings
186 }
187  
188 sub prevsib {
189 0 ▶ my ($indi) = @_;
Subroutine prevsib: not called CC=2 SCAR=17.9
Pod undocumented
190 0 ▶ return undef unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
191 0 scalar $indi->older_siblings
192 }
193  
194 sub sex {
195 67 ▶ my ($indi) = @_;
Subroutine sex: called CC=2 SCAR=7.1
Pod undocumented
196 67 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 67 67
197 67 $indi->sex
198 }
199  
200 sub male {
201 0 ▶ my ($indi) = @_;
Subroutine male: not called CC=2 SCAR=17.9
Pod undocumented
202 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
203 0 $indi->sex eq "M"
204 }
205  
206 sub female {
207 0 ▶ my ($indi) = @_;
Subroutine female: not called CC=2 SCAR=17.9
Pod undocumented
208 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
209 0 $indi->sex eq "F"
210 }
211  
212 sub pn {
213 0 ▶ my ($indi, $type) = @_;
Subroutine pn: not called CC=3 SCAR=24.8
Pod undocumented
214 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
215 0 ▶ (qw(He She he she His Her his her him her))[
Branch: 1 branch
BranchTrueFalseTotal
$indi->sex eq 'F' ? : 0 0 0
216 $type * 2 + ($indi->sex eq "F" ? 1 : 0)
217 ]
218 }
219  
220 sub nspouses {
221 0 ▶ my ($indi) = @_;
Subroutine nspouses: not called CC=2 SCAR=17.9
Pod undocumented
222 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
223 0 my @a = $indi->spouse;
224 scalar @a
225 0 }
226  
227 sub nfamilies {
228 0 ▶ my ($indi) = @_;
Subroutine nfamilies: not called CC=2 SCAR=17.9
Pod undocumented
229 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
230 0 my @a = $indi->fams;
231 scalar @a
232 0 }
233  
234 sub parents {
235 0 ▶ my ($indi) = @_;
Subroutine parents: not called CC=2 SCAR=17.9
Pod undocumented
236 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
237 0 my $a = $indi->famc;
238 0 $a
239 }
240  
241 sub title {
242 0 ▶ my ($indi) = @_;
Subroutine title: not called CC=2 SCAR=17.9
Pod undocumented
243 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
244 0 $indi->tag_value("TITL")
245 }
246  
247 sub key {
248 0 ▶ my ($record, $type) = @_;
Subroutine key: not called CC=3 SCAR=24.8
Pod undocumented
249 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
250 0 my $key = $record->xref;
251 0 ▶ $key =~ s/^[a-z]*//i if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 0 0 0
252 0 $key
253 }
254  
255 sub soundex {
256 0 ▶ my ($indi) = @_;
Subroutine soundex: not called CC=2 SCAR=17.9
Pod undocumented
257 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
258 0 $indi->soundex
259 }
260  
261 sub inode {
262 93 ▶ my ($indi) = @_;
Subroutine inode: called CC=1 SCAR=0.0
Pod undocumented
263 93 $indi;
264 }
265  
266 sub root {
267 0 ▶ my ($record) = @_;
Subroutine root: not called CC=1 SCAR=6.9
Pod undocumented
268 0 $record;
269 }
270  
271 sub indi {
272 0 ▶ my ($name) = @_;
Subroutine indi: not called CC=1 SCAR=6.9
Pod undocumented
273 0 $Ged->get_individual($name)
274 }
275  
276 sub firstindi {
277 0 ▶ (sort { key($a, 1) <=> key($b, 1) } $Ged->individuals)[0]
Subroutine firstindi: not called CC=1 SCAR=6.9
Pod undocumented
278 }
279  
280 sub nextindi {
281 0 ▶ my ($indi) = @_;
Subroutine nextindi: not called CC=5 SCAR=34.0
Pod undocumented
282 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
283 0 my @a = sort { key($a, 1) <=> key($b, 1) } $Ged->individuals;
284 0 my $i;
285 0 ▶ for ($i = 0; $i <= $#a; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#a) 0 0 0
286 last if $a[$i]->{xref} eq $indi->{xref}
287 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
if $a[$i]{"xref"} eq $indi->{"xref"} 0 0 0
288 0 splice @a, 0, $i + 1;
289 0 ▶ wantarray ? @a : $a[0]
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
290 }
291  
292 sub previndi {
293 0 ▶ my ($indi) = @_;
Subroutine previndi: not called CC=5 SCAR=34.0
Pod undocumented
294 0 ▶ return unless $indi;
Branch: 1 branch
BranchTrueFalseTotal
unless $indi 0 0 0
295 0 my @a = sort { key($a, 1) <=> key($b, 1) } $Ged->individuals;
296 0 my $i;
297 0 ▶ for ($i = 0; $i <= $#a; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#a) 0 0 0
298 last if $a[$i]->{xref} eq $indi->{xref}
299 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
if $a[$i]{"xref"} eq $indi->{"xref"} 0 0 0
300 0 splice @a, $i;
301 0 ▶ wantarray ? @a : $a[-1]
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
302 }
303  
304 sub marriage {
305 0 ▶ my ($fam) = @_;
Subroutine marriage: not called CC=2 SCAR=17.9
Pod undocumented
306 0 ▶ return unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
307 0 $fam->marr
308 }
309  
310 sub husband {
311 0 ▶ my ($fam) = @_;
Subroutine husband: not called CC=2 SCAR=17.9
Pod undocumented
312 0 ▶ return undef unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
313 0 scalar $fam->husband
314 }
315  
316 sub wife {
317 0 ▶ my ($fam) = @_;
Subroutine wife: not called CC=2 SCAR=17.9
Pod undocumented
318 0 ▶ return undef unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
319 0 scalar $fam->wife
320 }
321  
322 sub nchildren {
323 0 ▶ my ($fam) = @_;
Subroutine nchildren: not called CC=2 SCAR=17.9
Pod undocumented
324 0 ▶ return unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
325 0 $fam->number_of_children
326 }
327  
328 sub firstchild {
329 0 ▶ my ($fam) = @_;
Subroutine firstchild: not called CC=2 SCAR=17.9
Pod undocumented
330 0 ▶ return undef unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
331 0 scalar $fam->children
332 }
333  
334 sub lastchild {
335 0 ▶ my ($fam) = @_;
Subroutine lastchild: not called CC=2 SCAR=17.9
Pod undocumented
336 0 ▶ return undef unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
337 0 scalar $fam->children
338 }
339  
340 sub fnode {
341 0 ▶ my ($fam) = @_;
Subroutine fnode: not called CC=1 SCAR=6.9
Pod undocumented
342 0 $fam;
343 }
344  
345 sub fam {
346 0 ▶ my ($xref) = @_;
Subroutine fam: not called CC=1 SCAR=6.9
Pod undocumented
347 0 $Ged->resolve_xref($xref)
348 }
349  
350 sub firstfam {
351 0 ▶ (sort { key($a, 1) <=> key($b, 1) } $Ged->families)[0]
Subroutine firstfam: not called CC=1 SCAR=6.9
Pod undocumented
352 }
353  
354 sub nextfam {
355 0 ▶ my ($fam) = @_;
Subroutine nextfam: not called CC=5 SCAR=34.0
Pod undocumented
356 0 ▶ return unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
357 0 my @a = sort { key($a, 1) <=> key($b, 1) } $Ged->families;
358 0 my $i;
359 0 ▶ for ($i = 0; $i <= $#a; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#a) 0 0 0
360 last if $a[$i]->{xref} eq $fam->{xref}
361 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
if $a[$i]{"xref"} eq $fam->{"xref"} 0 0 0
362 0 splice @a, 0, $i + 1;
363 0 ▶ wantarray ? @a : $a[0]
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
364 }
365  
366 sub prevfam {
367 0 ▶ my ($fam) = @_;
Subroutine prevfam: not called CC=5 SCAR=34.0
Pod undocumented
368 0 ▶ return unless $fam;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam 0 0 0
369 0 my @a = sort { key($a, 1) <=> key($b, 1) } $Ged->families;
370 0 my $i;
371 0 ▶ for ($i = 0; $i <= $#a; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#a) 0 0 0
372 last if $a[$i]->{xref} eq $fam->{xref}
373 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
if $a[$i]{"xref"} eq $fam->{"xref"} 0 0 0
374 0 splice @a, $i;
375 0 ▶ wantarray ? @a : $a[-1]
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
376 }
377  
378 sub xref {
379 0 ▶ my ($record) = @_;
Subroutine xref: not called CC=2 SCAR=17.9
Pod undocumented
380 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
381 0 $record->xref
382 }
383  
384 sub tag {
385 0 ▶ my ($record) = @_;
Subroutine tag: not called CC=2 SCAR=17.9
Pod undocumented
386 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
387 0 $record->tag
388 }
389  
390 sub value {
391 0 ▶ my ($record) = @_;
Subroutine value: not called CC=2 SCAR=17.9
Pod undocumented
392 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
393 0 $record->full_value
394 }
395  
396 sub parent {
397 0 ▶ my ($record) = @_;
Subroutine parent: not called CC=2 SCAR=17.9
Pod undocumented
398 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
399 0 $record->parent
400 }
401  
402 sub child {
403 0 ▶ my ($record) = @_;
Subroutine child: not called CC=2 SCAR=17.9
Pod undocumented
404 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
405 0 $record->_items()->[0]
406 }
407  
408 sub sibling {
409 0 ▶ my ($record) = @_;
Subroutine sibling: not called CC=6 SCAR=37.4
Pod undocumented
410 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
411  
412 0 my $parent = $record->parent;
413 0 ▶ return unless $parent;
Branch: 1 branch
BranchTrueFalseTotal
unless $parent 0 0 0
414  
415 0 my $r = "$record";
416 0 my $n = 0;
417 0 for (@{$parent->_items}) {
418 0 ▶ last if $r eq "$_";
Branch: 1 branch
BranchTrueFalseTotal
if $r eq "$_" 0 0 0
419 0 $n++;
420 }
421  
422 0 ▶ return unless $n < $#{$parent->{items}};
Branch: 1 branch
BranchTrueFalseTotal
unless $n < $#{$$parent{"items"};} 0 0 0
423  
424 0 $parent->{items}[$n + 1]
425 }
426  
427 sub savenode {
428 0 ▶ my ($record) = @_;
Subroutine savenode: not called CC=2 SCAR=17.9
Pod undocumented
429 0 ▶ return unless $record;
Branch: 1 branch
BranchTrueFalseTotal
unless $record 0 0 0
430 0 $record->copy
431 }
432  
433 sub date {
434 0 ▶ my ($event) = @_;
Subroutine date: not called CC=3 SCAR=24.8
Pod undocumented
435 0 ▶ return unless $event;
Branch: 1 branch
BranchTrueFalseTotal
unless $event 0 0 0
436 0 ▶ $event->date || ""
Branch: 1 branch
BranchTrueFalseTotal
$event->date or "" 0 0 0
437 }
438  
439 sub place {
440 0 ▶ my ($event) = @_;
Subroutine place: not called CC=3 SCAR=24.8
Pod undocumented
441 0 ▶ return unless $event;
Branch: 1 branch
BranchTrueFalseTotal
unless $event 0 0 0
442 0 ▶ $event->place || ""
Branch: 1 branch
BranchTrueFalseTotal
$event->place or "" 0 0 0
443 }
444  
445 sub year {
446 0 ▶ my ($event) = @_;
Subroutine year: not called CC=3 SCAR=24.8
Pod undocumented
447 0 ▶ return unless $event;
Branch: 1 branch
BranchTrueFalseTotal
unless $event 0 0 0
448 0 $event->date =~ /(\d{3,4})/;
449 0 ▶ $1 || ""
Branch: 1 branch
BranchTrueFalseTotal
$1 or "" 0 0 0
450 }
451  
452 sub long {
453 0 ▶ my ($event) = @_;
Subroutine long: not called CC=2 SCAR=17.9
Pod undocumented
454 0 ▶ return unless $event;
Branch: 1 branch
BranchTrueFalseTotal
unless $event 0 0 0
455 0 date($event) . ", " . place($event)
456 }
457  
458 sub short {
459 0 ▶ my ($event) = @_;
Subroutine short: not called CC=3 SCAR=24.8
Pod undocumented
460 0 ▶ return unless $event;
Branch: 1 branch
BranchTrueFalseTotal
unless $event 0 0 0
461 0 ▶ year($event) . ", " . ((split(/,\s*/, place($event)))[-1] || "")
Condition0%0/2
(split(/,\s*/, place($event), 0))[-1] || ''
l!l
00
MC/DC0%0/1
(split(/,\s*/, place($event), 0))[-1] || ''
(split(/,\s*/, place($event), 0))[-1]
Truth table0%0/2
A
A= (split(/,\s*/, place($event), 0))[-1]
Aresult
11
00
462 }
463  
464 sub gettoday {
465 0 ▶ my $event = Gedcom::Event->new(gedcom => $Ged);
Subroutine gettoday: not called CC=1 SCAR=6.9
Pod undocumented
466 0 $event->add("date", uc join " ", (localtime)[2, 1, 4])
467 }
468  
469 sub dayformat {
470 0 ▶ $Day_format = shift || 0;
Subroutine dayformat: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
471 return
472 0 }
473  
474 sub monthformat {
475 0 ▶ $Month_format = shift || 0;
Subroutine monthformat: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
476 return
477 0 }
478  
479 sub dateformat {
480 0 ▶ $Date_format = shift || 0;
Subroutine dateformat: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
481 return
482 0 }
483  
484 sub stddate {
485 0 ▶ my ($event) = @_;
Subroutine stddate: not called CC=11 SCAR=48.8
Pod undocumented
486 0 my $date = date($event);
487 0 ▶ return "" unless $date;
Branch: 1 branch
BranchTrueFalseTotal
unless $date 0 0 0
488 0 ▶ unless ($INC{"Date/Manip.pm"}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($INC{"Date/Manip.pm"}) 0 0 0
489 0 warn "Date::Manip.pm is required to use stddate()";
490 0 return $date;
491 }
492 0 my $dt = ParseDate($date);
493 0 ▶ my $d = UnixDate($dt, $Day_format == 1 ? "%d" : "%e");
Branch: 1 branch
BranchTrueFalseTotal
$Day_format == 1 ? : 0 0 0
494 0 ▶ $d = int $d if $Day_format == 2;
Branch: 1 branch
BranchTrueFalseTotal
if $Day_format == 2 0 0 0
495 0 ▶ my $m = UnixDate($dt,
Branch: 3 branches
BranchTrueFalseTotal
$Month_format > 4 ? : 0 0 0
$Month_format > 2 ? : 0 0 0
$Month_format == 1 ? : 0 0 0
496 $Month_format > 4 ? "%B"
497 : $Month_format > 2 ? "%b"
498 : $Month_format == 1 ? "%m"
499 : "%f"
500 );
501 0 ▶ $m = int $m if $Month_format == 2;
Branch: 1 branch
BranchTrueFalseTotal
if $Month_format == 2 0 0 0
502 0 ▶ $m = uc $m if $Month_format == 3 || $Month_format == 5;
Branch: 1 branch
BranchTrueFalseTotal
if $Month_format == 3 or $Month_format == 5 0 0 0
Condition0%0/3
$Month_format == 3 or $Month_format == 5
l!l&&r!l&&!r
000
MC/DC0%0/2
$Month_format == 3 or $Month_format == 5
$Month_format == 3 $Month_format == 5
Truth table0%0/3
A or B
A= $Month_format == 3B= $Month_format == 5
ABresult
1X1
011
000
503 0 my $y = UnixDate($dt, "%Y");
504 (
505 0 "$d $m $y",
506 "$m $d, $y",
507 "$m/$d/$y",
508 "$d/$m/$y",
509 "$m-$d-$y",
510 "$d-$m-$y",
511 "$m$d$y",
512 "$d$m$y",
513 "$y $m $d",
514 "$y/$m/$d",
515 "$y-$m-$d",
516 "$y$m$d",
517 )[$Date_format]
518 }
519  
520 sub extractdate {
521 0 ▶ my $record = shift or return;
Subroutine extractdate: not called CC=6 SCAR=37.4
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $record = shift() or return 0 0 0
522 0 my $d = \shift;
523 0 my $m = \shift;
524 0 my $y = \shift;
525 0 $$d = $$m = $$y = 0;
526 0 ▶ my $date = $record->tag eq "DATE" ? $record->full_value : $record->date;
Branch: 1 branch
BranchTrueFalseTotal
$record->tag eq 'DATE' ? : 0 0 0
527 0 ▶ return unless $date;
Branch: 1 branch
BranchTrueFalseTotal
unless $date 0 0 0
528 0 ▶ unless ($INC{"Date/Manip.pm"}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($INC{"Date/Manip.pm"}) 0 0 0
529 0 warn "Date::Manip.pm is required to use extractdate()";
530 0 return;
531 }
532 0 my $dt = ParseDate($date);
533 0 ▶ return unless $dt;
Branch: 1 branch
BranchTrueFalseTotal
unless $dt 0 0 0
534 0 $$d = int UnixDate($dt, "%e");
535 0 $$m = int UnixDate($dt, "%f");
536 0 $$y = int UnixDate($dt, "%Y");
537 return
538 0 }
539  
540 sub extractnames {
541 93 ▶ my $record = shift;
Subroutine extractnames: called CC=6 SCAR=18.0
Pod undocumented
542 93 my $names = \shift;
543 93 my $count = \shift;
544 93 my $surname = \shift;
545 93 $$names = [];
546 93 $$count = $$surname = 0;
547 93 ▶ my $name = $record->tag eq "NAME" ? $record->full_value : $record->name;
Branch: 1 branch
BranchTrueFalseTotal
$record->tag eq 'NAME' ? : 0 93 93
548 93 ▶ return unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 93 93
549  
550 93 my ($before, $sn, $after) = split "/", $name;
551 93 my @bf = split " ", $before;
552 93 my @af = split " ", $after;
553 93 ▶ $$count = @bf + @af; $$count++ if $sn;
Branch: 1 branch
BranchTrueFalseTotal
if $sn 75 18 93
554 93 ▶ $$names = [@bf, $sn || (), @af];
Condition66%2/3
$sn || ()
l!l&&r!l&&!r
75180
MC/DC0%0/2
$sn || ()
$sn ()
Truth table66%2/3
A || B
A= $snB= ()
ABresult
1X1
011
000
555 93 ▶ $$surname = $sn ? @bf + 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$sn ? : 75 18 93
556  
557 # print "[$name] [", join("|", @$$names), "], $$count, $$surname, \n";
558 return
559 93 }
560  
561 sub extractplaces {
562 0 ▶ my $record = shift;
Subroutine extractplaces: not called CC=3 SCAR=24.8
Pod undocumented
563 0 my $places = \shift;
564 0 my $count = \shift;
565 0 $$places = [];
566 0 $$count = 0;
567 0 ▶ my $place = $record->tag eq "PLACE" ? $record->full_value : $record->place;
Branch: 1 branch
BranchTrueFalseTotal
$record->tag eq 'PLACE' ? : 0 0 0
568 0 ▶ return unless $place;
Branch: 1 branch
BranchTrueFalseTotal
unless $place 0 0 0
569 0 @$$places = split /\s*,\s*/, $place;
570 0 $$count = scalar @$$places;
571 return
572 0 }
573  
574 sub extracttokens {
575 0 ▶ my $string = shift;
Subroutine extracttokens: not called CC=2 SCAR=17.9
Pod undocumented
576 0 my $tokens = \shift;
577 0 my $count = \shift;
578 0 my $delimiters = shift;
579 0 $$tokens = [];
580 0 $$count = 0;
581 0 ▶ return unless $string;
Branch: 1 branch
BranchTrueFalseTotal
unless $string 0 0 0
582 0 @$$tokens = split /[\Q$delimiters\E]/, $string;
583 0 $$count = scalar @$$tokens;
584 return
585 0 }
586  
587 sub getindi {
588 0 ▶ my $indi = \shift;
Subroutine getindi: not called CC=2 SCAR=17.9
Pod undocumented
589 0 ▶ my $string = shift || "Please specify an individual";
Condition0%0/2
shift() || 'Please specify an individual'
l!l
00
MC/DC0%0/1
shift() || 'Please specify an individual'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
590 0 print STDERR $string, " ";
591 0 my $i = <STDIN>;
592 0 chomp $i;
593 # print "looking for $i\n";
594 0 $$indi = indi($i);
595 # print "found $$indi - ", $$indi->name, "\n";
596 return
597 0 }
598  
599 0 ▶sub getindimsg { getindi(@_) }
Subroutine getindimsg: not called CC=1 SCAR=6.9
Pod undocumented
600  
601 0 ▶sub getindiset { die "LifeLines getindiset function not yet implemented" }
Subroutine getindiset: not called CC=1 SCAR=6.9
Pod undocumented
602  
603 sub getfam {
604 0 ▶ my $fam = \shift;
Subroutine getfam: not called CC=4 SCAR=30.0
Pod undocumented
605 0 ▶ my $string = shift || "Please enter a family:";
Condition0%0/2
shift() || 'Please enter a family:'
l!l
00
MC/DC0%0/1
shift() || 'Please enter a family:'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
606 0 print STDERR $string, " ";
607 0 my $f = <STDIN>;
608 0 chomp $f;
609 0 ▶ $$fam = $Ged->resolve_xref($f) ||
Condition0%0/6
$Ged->resolve_xref($f) || $Ged->resolve_xref(uc $f) || $Ged->resolve_xref("F$f")
l!l&&r!l&&!r
000
$Ged->resolve_xref($f) or $Ged->resolve_xref(uc $f)
l!l&&r!l&&!r
000
MC/DC0%0/3
$Ged->resolve_xref($f) || $Ged->resolve_xref(uc $f) || $Ged->resolve_xref("F$f")
$Ged->resolve_xref($f) $Ged->resolve_xref(uc $f) $Ged->resolve_xref("F$f")
Truth table0%0/4
A or B || C
A= $Ged->resolve_xref($f)B= $Ged->resolve_xref(uc $f)C= $Ged->resolve_xref("F$f")
ABCresult
1XX1
01X1
0011
0000
610 $Ged->resolve_xref(uc $f) ||
611 $Ged->resolve_xref("F$f");
612 return
613 0 }
614  
615 sub getint {
616 0 ▶ my $number = \shift;
Subroutine getint: not called CC=2 SCAR=17.9
Pod undocumented
617 0 ▶ my $string = shift || "Please enter an integer:";
Condition0%0/2
shift() || 'Please enter an integer:'
l!l
00
MC/DC0%0/1
shift() || 'Please enter an integer:'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
618 0 print STDERR $string, " ";
619 0 $$number = <STDIN>;
620 0 chomp $$number;
621 return
622 0 }
623  
624 0 ▶sub getintmsg { getint(@_) }
Subroutine getintmsg: not called CC=1 SCAR=6.9
Pod undocumented
625  
626 sub getstr {
627 0 ▶ my $str = \shift;
Subroutine getstr: not called CC=2 SCAR=17.9
Pod undocumented
628 0 ▶ my $string = shift || "Please enter a string:";
Condition0%0/2
shift() || 'Please enter a string:'
l!l
00
MC/DC0%0/1
shift() || 'Please enter a string:'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
629 0 print STDERR $string, " ";
630 0 $$str = <STDIN>;
631 return
632 0 }
633  
634 0 ▶sub getstrmsg { getstr(@_) }
Subroutine getstrmsg: not called CC=1 SCAR=6.9
Pod undocumented
635  
636 0 ▶sub choosechild { die "LifeLines choosechild function not yet implemented" }
Subroutine choosechild: not called CC=1 SCAR=6.9
Pod undocumented
637 0 ▶sub choosefam { die "LifeLines choosefam function not yet implemented" }
Subroutine choosefam: not called CC=1 SCAR=6.9
Pod undocumented
638 0 ▶sub chooseindi { die "LifeLines chooseindi function not yet implemented" }
Subroutine chooseindi: not called CC=1 SCAR=6.9
Pod undocumented
639 0 ▶sub choosesubset { die "LifeLines choosesubset function not yet implemented" }
Subroutine choosesubset: not called CC=1 SCAR=6.9
Pod undocumented
640 0 ▶sub menuchoose { die "LifeLines menuchoose function not yet implemented" }
Subroutine menuchoose: not called CC=1 SCAR=6.9
Pod undocumented
641  
642 sub lower {
643 0 ▶ my ($string) = @_;
Subroutine lower: not called CC=1 SCAR=6.9
Pod undocumented
644 0 lc $string
645 }
646  
647 sub upper {
648 0 ▶ my ($string) = @_;
Subroutine upper: not called CC=1 SCAR=6.9
Pod undocumented
649 0 uc $string
650 }
651  
652 sub capitalize
653 {
654 0 ▶ my $string = \shift;
Subroutine capitalize: not called CC=1 SCAR=6.9
Pod undocumented
655 0 $$string = ucfirst $$string
656 }
657  
658 sub trim {
659 0 ▶ my ($string, $length) = @_;
Subroutine trim: not called CC=1 SCAR=6.9
Pod undocumented
660 0 substr $string, 0, $length
661 }
662  
663 sub rjustify {
664 0 ▶ my ($string, $length) = @_;
Subroutine rjustify: not called CC=1 SCAR=6.9
Pod undocumented
665 0 $string = substr $string, 0, $length;
666 0 " " x ($length - length $string) . $string
667 }
668  
669 sub save {
670 93 ▶ my ($string) = @_;
Subroutine save: called CC=1 SCAR=0.0
Pod undocumented
671 93 $string
672 }
673  
674 sub strsave {
675 0 ▶ my ($string) = @_;
Subroutine strsave: not called CC=1 SCAR=6.9
Pod undocumented
676 0 $string
677 }
678  
679 sub concat {
680 0 ▶ join "", @_
Subroutine concat: not called CC=1 SCAR=6.9
Pod undocumented
681 }
682  
683 sub strconcat {
684 0 ▶ join "", @_
Subroutine strconcat: not called CC=1 SCAR=6.9
Pod undocumented
685 }
686  
687 sub strlen {
688 96 ▶ my ($string) = @_;
Subroutine strlen: called CC=1 SCAR=0.0
Pod undocumented
689 96 length $string
690 }
691  
692 sub substring {
693 0 ▶ my ($string, $start, $end) = @_;
Subroutine substring: not called CC=1 SCAR=6.9
Pod undocumented
694 0 substr $string, $start - 1, $end - $start + 1
695 }
696  
697 sub index {
698 0 ▶ my ($string, $substring, $occurrence) = @_;
Subroutine index: not called CC=3 SCAR=24.8
Pod undocumented
699 0 my $pos = 0;
700 0 ▶ while ($occurrence-- && ($pos = index $string, $substring, $pos) >= 0) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($occurrence-- and ($pos = CORE::index($string, $substring, $pos)) >= 0) 0 0 0
Condition0%0/3
$occurrence-- and ($pos = CORE::index($string, $substring, $pos)) >= 0
!ll&&!rl&&r
000
MC/DC0%0/2
$occurrence-- and ($pos = CORE::index($string, $substring, $pos)) >= 0
$occurrence-- ($pos = CORE::index($string, $substring, $pos)) >= 0
Truth table0%0/3
A and B
A= $occurrence--B= ($pos = CORE::index($string, $substring, $pos)) >= 0
ABresult
0X0
100
111
701 0 $pos + 1
702 }
703  
704 sub d {
705 206 ▶ my ($number) = @_;
Subroutine d: called CC=2 SCAR=6.9
Pod undocumented
706 206 ▶ $number ? int $number : 0
Branch: 1 branch
BranchTrueFalseTotal
$number ? : 200 6 206
707 }
708  
709 sub card {
710 0 ▶ my ($number) = @_;
Subroutine card: not called CC=3 SCAR=24.8
Pod undocumented
711 0 my @cardinals = qw (
712 zero one two three four five six seven eight nine ten eleven twelve
713 );
714  
715 0 ▶ $number < 0 || $number > $#cardinals ? $number : $cardinals[$number]
Branch: 1 branch
BranchTrueFalseTotal
$number < 0 || $number > $#cardinals ? : 0 0 0
Condition0%0/3
$number < 0 or $number > $#cardinals
l!l&&r!l&&!r
000
MC/DC0%0/2
$number < 0 or $number > $#cardinals
$number < 0 $number > $#cardinals
Truth table0%0/3
A or B
A= $number < 0B= $number > $#cardinals
ABresult
1X1
011
000
716 }
717  
718 sub ord {
719 0 ▶ my ($number) = @_;
Subroutine ord: not called CC=5 SCAR=34.0
Pod undocumented
720 0 my @ordinals = qw (
721 zeroth first second third fourth fifth sixth
722 seventh eighth ninth tenth eleventh twelfth
723 );
724 0 my @suffixes = qw( th st nd rd th th th th th th );
725  
726 0 ▶ return if $number < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $number < 0 0 0 0
727 0 ▶ return $ordinals[$number] if $number < @ordinals;
Branch: 1 branch
BranchTrueFalseTotal
if $number < @ordinals 0 0 0
728 0 my $n = $number % 100;
729 0 ▶ return $number . "th" if $n < 10 && $n < 14;
Branch: 1 branch
BranchTrueFalseTotal
if $n < 10 and $n < 14 0 0 0
Condition0%0/3
$n < 10 and $n < 14
!ll&&!rl&&r
000
MC/DC0%0/2
$n < 10 and $n < 14
$n < 10 $n < 14
Truth table0%0/3
A and B
A= $n < 10B= $n < 14
ABresult
0X0
100
111
730 0 return $number . $suffixes[$number % 10];
731 }
732  
733 sub alpha {
734 0 ▶ my ($number) = @_;
Subroutine alpha: not called CC=1 SCAR=6.9
Pod undocumented
735 0 chr CORE::ord 'a' - $number
736 }
737  
738 sub roman {
739 0 ▶ my ($number) = @_;
Subroutine roman: not called CC=2 SCAR=17.9
Pod undocumented
740 0 ▶ unless ($INC{"Roman.pm"}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($INC{"Roman.pm"}) 0 0 0
741 0 warn "Roman.pm is required to use roman()";
742 0 return $number;
743 }
744 0 Roman::roman($number)
745 }
746  
747 sub strsoundex {
748 0 ▶ my ($string) = @_;
Subroutine strsoundex: not called CC=1 SCAR=6.9
Pod undocumented
749 0 Gedcom::soundex($string)
750 }
751  
752 sub strtoint {
753 0 ▶ my ($string) = @_;
Subroutine strtoint: not called CC=1 SCAR=6.9
Pod undocumented
754 0 local $^W;
755 0 int $string
756 }
757  
758 sub atoi {
759 0 ▶ strtoint(@_)
Subroutine atoi: not called CC=1 SCAR=6.9
Pod undocumented
760 }
761  
762 sub strcmp {
763 968 ▶ my ($string1, $string2) = @_;
Subroutine strcmp: called CC=1 SCAR=0.0
Pod undocumented
764 968 $string1 cmp $string2
765 }
766  
767 sub eqstr {
768 0 ▶ my ($string1, $string2) = @_;
Subroutine eqstr: not called CC=1 SCAR=6.9
Pod undocumented
769 0 $string1 eq $string2
770 }
771  
772 sub nestr {
773 0 ▶ my ($string1, $string2) = @_;
Subroutine nestr: not called CC=1 SCAR=6.9
Pod undocumented
774 0 $string1 ne $string2
775 }
776  
777 sub linemode {
778 0 ▶ $Line_mode = 1;
Subroutine linemode: not called CC=1 SCAR=6.9
Pod undocumented
779 return
780 0 }
781  
782 sub pagemode {
783 0 ▶ my ($rows, $columns) = @_;
Subroutine pagemode: not called CC=4 SCAR=30.0
Pod undocumented
784 0 $Line_mode = 0;
785 0 ▶ $Rows = $rows || 0;
Condition0%0/2
$rows || 0
l!l
00
MC/DC0%0/1
$rows || 0
$rows
Truth table0%0/2
A
A= $rows
Aresult
11
00
786 0 ▶ $Columns = $columns || 0;
Condition0%0/2
$columns || 0
l!l
00
MC/DC0%0/1
$columns || 0
$columns
Truth table0%0/2
A
A= $columns
Aresult
11
00
787 0 $#Lines = $Rows;
788 0 $Lines[$_] = "" for 0..$Rows - 1;
789 return
790 0 }
791  
792 sub col {
793 101 ▶ my ($column) = @_;
Subroutine col: called CC=3 SCAR=11.8
Pod undocumented
794 101 $column--;
795 101 ▶ if ($Line_mode) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Line_mode) { } 101 0 101
796 101 ▶ display(length $Line > $column
Branch: 1 branch
BranchTrueFalseTotal
length $Line > $column ? : 0 101 101
797 ? "\n" . " " x $column
798 : " " x ($column - length $Line))
799 } else {
800 0 $Column = $column
801 }
802 return
803 101 }
804  
805 sub row {
806 0 ▶ my ($row) = @_;
Subroutine row: not called CC=2 SCAR=17.9
Pod undocumented
807 0 ▶ unless ($Line_mode) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Line_mode) 0 0 0
808 0 $Row = $row - 1;
809 0 $Column = 0;
810 }
811 return
812 0 }
813  
814 sub pos {
815 0 ▶ my ($row, $column) = @_;
Subroutine pos: not called CC=2 SCAR=17.9
Pod undocumented
816 0 ▶ ($Row, $Column) = ($row - 1, $column - 1) unless $Line_mode;
Branch: 1 branch
BranchTrueFalseTotal
unless $Line_mode 0 0 0
817 return
818 0 }
819  
820 sub pageout {
821 # print join "\n", map { substr($_, 0, $Columns) } @Lines[0..$Rows - 1];
822 0 ▶ print substr($Lines[$_], 0, $Columns), "\n" for 0..$Rows - 1;
Subroutine pageout: not called CC=3 SCAR=24.8
Pod undocumented
823 0 $Lines[$_] = "" for 0..$Rows - 1;
824 0 $Row = $Column = 0;
825 return
826 0 }
827  
828 1 ▶sub nl { "\n" }
Subroutine nl: called CC=1 SCAR=0.0
Pod undocumented
829 0 ▶sub sp { " " }
Subroutine sp: not called CC=1 SCAR=6.9
Pod undocumented
830 0 ▶sub qt { '"' }
Subroutine qt: not called CC=1 SCAR=6.9
Pod undocumented
831  
832 {
833 3 my $Openfile;
834  
835 sub newfile {
836 0 ▶ my ($filename, $append) = @_;
Subroutine newfile: not called CC=3 SCAR=24.8
Pod undocumented
837  
838 0 flush();
839 0 ▶ my $mode = $append ? ">>" : ">";
Branch: 1 branch
BranchTrueFalseTotal
$append ? : 0 0 0
840 0 ▶ open LLOUT, "$mode$filename" or die "Cannot open $filename\n";
Branch: 1 branch
BranchTrueFalseTotal
open LLOUT, "$mode$filename" or die "Cannot open $filename\n" 0 0 0
841 0 select LLOUT;
842 0 $Openfile = $filename;
843 0 return;
844 }
845  
846 0 ▶ sub outfile { $Openfile }
Subroutine outfile: not called CC=1 SCAR=6.9
Pod undocumented
847 }
848  
849 3 sub copyfile {
850 0 ▶ my ($file) = @_;
Subroutine copyfile: not called CC=5 SCAR=34.0
Pod undocumented
851 0 ▶ $file = "$ENV{LLPROGRAMS}/$file" unless -e $file;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $file 0 0 0
852 0 ▶ unless (open(F, $file)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (open F, $file) 0 0 0
853 0 warn "Error: Cannot open file $file in copyfile: $!";
854 0 return;
855 }
856 0 ▶ print while <F>;
Branch: 1 branch
BranchTrueFalseTotal
defined($_ = readline F) and do { print $_ } 0 0 0
857 0 ▶ close F or warn "Error: Cannot close file $file in copyfile: $!";
Branch: 1 branch
BranchTrueFalseTotal
close F or warn "Error: Cannot close file $file in copyfile: $!" 0 0 0
858 }
859  
860 sub print {
861 4 ▶ print STDERR @_;
Subroutine print: called CC=1 SCAR=0.0
Pod undocumented
862 return
863 4 }
864  
865 sub addtoset {
866 0 ▶ my ($set, $indi, $data) = @_;
Subroutine addtoset: not called CC=1 SCAR=6.9
Pod undocumented
867 0 push @$set, [$indi, $data];
868 return
869 0 }
870  
871 sub deletefromset {
872 0 ▶ my ($set, $indi, $all) = @_;
Subroutine deletefromset: not called CC=4 SCAR=30.0
Pod undocumented
873 0 my $count = 0;
874 my @new = grep {
875 0 ▶ my $keep = ($count && !$all) || $_->[0] ne $indi;
Condition0%0/6
$count && !$all || $_->[0] ne $indi
l!l&&r!l&&!r
000
$count and not $all
!ll&&!rl&&r
000
MC/DC0%0/3
$count && !$all || $_->[0] ne $indi
$count not $all $_->[0] ne $indi
Truth table0%0/5
A and not(B) || C
A= $countB= not $allC= $_->[0] ne $indi
ABCresult
11X1
0X11
1011
0X00
1000
876 0 ▶ $count++ unless $keep;
Branch: 1 branch
BranchTrueFalseTotal
unless $keep 0 0 0
877 0 $keep
878 } @$set;
879 0 $_[0] = \@new;
880 return
881 0 }
882  
883 sub lengthset {
884 0 ▶ my ($set) = @_;
Subroutine lengthset: not called CC=1 SCAR=6.9
Pod undocumented
885 0 scalar @$set
886 }
887  
888 sub union {
889 0 ▶ my ($s1, $s2) = @_;
Subroutine union: not called CC=4 SCAR=30.0
Pod undocumented
890 0 my %s;
891 0 for my $e (@$s1, @$s2) {
892 0 ▶ $s{$e->[0]} = $e->[1] unless exists $s{$e->[0]}
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s{$e->[0]} 0 0 0
893 }
894 0 my @s;
895 0 ▶ while (my ($indi, $data) = each %s) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %s) 0 0 0
896 0 push @s, [$indi, $data]
897 }
898 \@s
899 0 }
900  
901 sub intersect {
902 0 ▶ my ($s1, $s2) = @_;
Subroutine intersect: not called CC=7 SCAR=40.3
Pod undocumented
903 0 my (%s1, %s2);
904 0 for my $e (@$s1) {
905 0 ▶ $s1{$e->[0]} = $e->[1] unless exists $s1{$e->[0]}
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s1{$e->[0]} 0 0 0
906 }
907 0 for my $e (@$s2) {
908 0 ▶ $s2{$e->[0]} = $e->[1] unless exists $s2{$e->[0]}
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s2{$e->[0]} 0 0 0
909 }
910 0 my @s;
911 0 ▶ while (my ($indi, $data) = each %s1) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %s1) 0 0 0
912 0 ▶ push @s, [$indi, $data] if exists $s2{$indi}
Branch: 1 branch
BranchTrueFalseTotal
if exists $s2{$indi} 0 0 0
913 }
914 \@s
915 0 }
916  
917 sub difference {
918 0 ▶ my ($s1, $s2) = @_;
Subroutine difference: not called CC=7 SCAR=40.3
Pod undocumented
919 0 my (%s1, %s2);
920 0 for my $e (@$s1) {
921 0 ▶ $s1{$e->[0]} = $e->[1] unless exists $s1{$e->[0]}
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s1{$e->[0]} 0 0 0
922 }
923 0 for my $e (@$s2) {
924 0 ▶ $s2{$e->[0]} = $e->[1] unless exists $s2{$e->[0]}
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s2{$e->[0]} 0 0 0
925 }
926 0 my @s;
927 0 ▶ while (my ($indi, $data) = each %s1) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %s1) 0 0 0
928 0 ▶ push @s, [$indi, $data] unless exists $s2{$indi}
Branch: 1 branch
BranchTrueFalseTotal
unless exists $s2{$indi} 0 0 0
929 }
930 \@s
931 0 }
932  
933 sub parentset {
934 0 ▶ my ($set) = @_;
Subroutine parentset: not called CC=1 SCAR=6.9
Pod undocumented
935 0 [ map { my ($i, $d) = @$_; map { [ $_ => $d ] } $i->parents } @$set ]
936 }
937  
938 sub childset {
939 0 ▶ my ($set) = @_;
Subroutine childset: not called CC=1 SCAR=6.9
Pod undocumented
940 0 [ map { my ($i, $d) = @$_; map { [ $_ => $d ] } $i->children } @$set ]
941 }
942  
943 sub spouseset {
944 0 ▶ my ($set) = @_;
Subroutine spouseset: not called CC=1 SCAR=6.9
Pod undocumented
945 0 [ map { my ($i, $d) = @$_; map { [ $_ => $d ] } $i->spouse } @$set ]
946 }
947  
948 sub siblingset {
949 0 ▶ my ($set) = @_;
Subroutine siblingset: not called CC=1 SCAR=6.9
Pod undocumented
950 0 [ map { my ($i, $d) = @$_; map { [ $_ => $d ] } $i->siblings } @$set ]
951 }
952  
953 sub ancestorset {
954 0 ▶ my ($set) = @_;
Subroutine ancestorset: not called CC=1 SCAR=6.9
Pod undocumented
955 # TODO - set the data appropriately
956 0 [ map { my $c = $_->[0]; map { [ $_ => 0 ] } $c->ancestors } @$set ]
957 }
958  
959 sub descendentset {
960 0 ▶ my ($set) = @_;
Subroutine descendentset: not called CC=1 SCAR=6.9
Pod undocumented
961 # TODO - set the data appropriately
962 0 [ map { my $c = $_->[0]; map { [ $_ => 0 ] } $c->descendents } @$set ]
963 }
964  
965 sub descendantset {
966 0 ▶ descendentset(@_)
Subroutine descendantset: not called CC=1 SCAR=6.9
Pod undocumented
967 }
968  
969 sub uniqueset {
970 0 ▶ my ($set) = @_;
Subroutine uniqueset: not called CC=1 SCAR=6.9
Pod undocumented
971 0 union($set, [])
972 }
973  
974 sub namesort {
975 0 ▶ my ($set) = @_;
Subroutine namesort: not called CC=1 SCAR=6.9
Pod undocumented
976 0 @$set = sort { fullname($a->[0]) cmp fullname($b->[0]) } @$set;
977 return
978 0 }
979  
980 sub keysort {
981 0 ▶ my ($set) = @_;
Subroutine keysort: not called CC=1 SCAR=6.9
Pod undocumented
982 0 @$set = sort { key($a->[0]) cmp key($b->[0]) } @$set;
983 return
984 0 }
985  
986 sub valuesort {
987 0 ▶ my ($set) = @_;
Subroutine valuesort: not called CC=1 SCAR=6.9
Pod undocumented
988 # TODO - should this be cmp?
989 0 @$set = sort { $a->[1] <=> $b->[1] } @$set;
990 return
991 0 }
992  
993 sub genindiset {
994 0 ▶ my $name = shift;
Subroutine genindiset: not called CC=1 SCAR=6.9
Pod undocumented
995 0 my $set = \shift;
996 0 $$set = [ map { $_ => 0 } $Ged->get_individual($name) ];
997 return
998 0 }
999  
1000 0 ▶sub gengedcom { die "LifeLines gengedcom function not yet implemented" }
Subroutine gengedcom: not called CC=1 SCAR=6.9
Pod undocumented
1001 0 ▶sub createnode { die "LifeLines createnode function not yet implemented" }
Subroutine createnode: not called CC=1 SCAR=6.9
Pod undocumented
1002 0 ▶sub addnode { die "LifeLines addnode function not yet implemented" }
Subroutine addnode: not called CC=1 SCAR=6.9
Pod undocumented
1003 0 ▶sub deletenode { die "LifeLines deletenode function not yet implemented" }
Subroutine deletenode: not called CC=1 SCAR=6.9
Pod undocumented
1004  
1005 sub reference {
1006 0 ▶ my ($ref) = @_;
Subroutine reference: not called CC=1 SCAR=6.9
Pod undocumented
1007 0 $Ged->resolve_xref($ref)
1008 }
1009  
1010 sub dereference {
1011 0 ▶ my ($ref) = @_;
Subroutine dereference: not called CC=1 SCAR=6.9
Pod undocumented
1012 0 $Ged->resolve_xref($ref)
1013 }
1014  
1015 0 ▶sub getrecord { dereference(@_) }
Subroutine getrecord: not called CC=1 SCAR=6.9
Pod undocumented
1016 0 ▶sub lock { return }
Subroutine lock: not called CC=1 SCAR=6.9
Pod undocumented
1017 0 ▶sub unlock { return }
Subroutine unlock: not called CC=1 SCAR=6.9
Pod undocumented
1018 0 ▶sub database { $Ged->{file} }
Subroutine database: not called CC=1 SCAR=6.9
Pod undocumented
1019 0 ▶sub version { $VERSION }
Subroutine version: not called CC=1 SCAR=6.9
Pod undocumented
1020 0 ▶sub system { system(@_) }
Subroutine system: not called CC=1 SCAR=6.9
Pod undocumented
1021  
1022 3 1;
1023  
1024 __END__
« blib/lib/Gedcom/Individual.pm ↑ Summary blib/lib/Gedcom/Record.pm »