| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Gedcom::Date::Range; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
29
|
use strict; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
169
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
27
|
use vars qw($VERSION @ISA); |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
363
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
|
8
|
|
|
|
|
|
|
@ISA = qw/Gedcom::Date/; |
|
9
|
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
28
|
use Gedcom::Date; |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
4397
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub parse { |
|
13
|
41
|
|
|
41
|
1
|
59
|
my $class = shift; |
|
14
|
41
|
|
|
|
|
77
|
my ($str) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
41
|
|
|
|
|
51
|
my ($aft, $bef); |
|
17
|
41
|
100
|
|
|
|
255
|
if ($str =~ /^BET (.*?) AND (.*)$/) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
18
|
3
|
50
|
|
|
|
15
|
$aft = Gedcom::Date::Simple->parse($1) or return; |
|
19
|
3
|
50
|
|
|
|
14
|
$bef = Gedcom::Date::Simple->parse($2) or return; |
|
20
|
|
|
|
|
|
|
} elsif ($str =~ /^AFT (.*)$/) { |
|
21
|
3
|
50
|
|
|
|
23
|
$aft = Gedcom::Date::Simple->parse($1) or return; |
|
22
|
|
|
|
|
|
|
} elsif ($str =~ /^BEF (.*)$/) { |
|
23
|
3
|
50
|
|
|
|
17
|
$bef = Gedcom::Date::Simple->parse($1) or return; |
|
24
|
|
|
|
|
|
|
} else { |
|
25
|
32
|
|
|
|
|
258
|
return; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
9
|
|
|
|
|
31
|
my $self = bless { |
|
29
|
|
|
|
|
|
|
aft => $aft, |
|
30
|
|
|
|
|
|
|
bef => $bef |
|
31
|
|
|
|
|
|
|
}, $class; |
|
32
|
|
|
|
|
|
|
|
|
33
|
9
|
|
|
|
|
226
|
return $self; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub gedcom { |
|
37
|
6
|
|
|
6
|
1
|
1432
|
my $self = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
6
|
50
|
|
|
|
20
|
if (!defined $self->{gedcom}) { |
|
40
|
6
|
100
|
100
|
|
|
40
|
if (defined($self->{aft}) && defined($self->{bef})) { |
|
|
|
100
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$self->{gedcom} = 'BET ' . $self->{aft}->gedcom() . |
|
42
|
2
|
|
|
|
|
9
|
' AND ' . $self->{bef}->gedcom(); |
|
43
|
|
|
|
|
|
|
} elsif (defined($self->{aft})) { |
|
44
|
2
|
|
|
|
|
37
|
$self->{gedcom} = 'AFT ' . $self->{aft}->gedcom(); |
|
45
|
|
|
|
|
|
|
} else { |
|
46
|
2
|
|
|
|
|
9
|
$self->{gedcom} = 'BEF ' . $self->{bef}->gedcom(); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
6
|
|
|
|
|
33
|
$self->{gedcom}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub latest { |
|
53
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
0
|
if ($self->{bef}) { |
|
56
|
0
|
|
|
|
|
0
|
return $self->{bef}->latest; |
|
57
|
|
|
|
|
|
|
} else { |
|
58
|
0
|
|
|
|
|
0
|
return DateTime::Infinite::Future->new; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub earliest { |
|
63
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
if ($self->{aft}) { |
|
66
|
0
|
|
|
|
|
0
|
return $self->{aft}->earliest; |
|
67
|
|
|
|
|
|
|
} else { |
|
68
|
0
|
|
|
|
|
0
|
return DateTime::Infinite::Past->new; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub sort_date { |
|
73
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
0
|
if (defined $self->{aft}) { |
|
76
|
0
|
|
|
|
|
0
|
return $self->{aft}->sort_date; |
|
77
|
|
|
|
|
|
|
} else { |
|
78
|
0
|
|
|
|
|
0
|
return $self->{bef}->sort_date; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my %text = ( |
|
83
|
|
|
|
|
|
|
en => ['after %0', 'before %1', 'between %0 and %1'], |
|
84
|
|
|
|
|
|
|
nl => ['na %0', 'voor %1', 'tussen %0 en %1'], |
|
85
|
|
|
|
|
|
|
); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub text_format { |
|
88
|
9
|
|
|
9
|
0
|
16
|
my ($self, $lang) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $type = defined($self->{bef}) ? |
|
91
|
9
|
100
|
|
|
|
29
|
(defined($self->{aft}) ? 2 : 1 ) : 0; |
|
|
|
100
|
|
|
|
|
|
|
92
|
9
|
|
|
|
|
36
|
return ($text{$lang}[$type], $self->{aft}, $self->{bef}); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |