line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gedcom::Date::Approximated; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
22
|
use strict; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
167
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
21
|
use vars qw($VERSION @ISA); |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
331
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
8
|
|
|
|
|
|
|
@ISA = qw/Gedcom::Date/; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
32
|
use Gedcom::Date; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
877
|
|
11
|
6
|
|
|
6
|
|
23
|
use Params::Validate qw/validate OBJECT SCALAR/; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
3173
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
11
|
|
|
11
|
0
|
11
|
my $class = shift; |
15
|
11
|
|
|
|
|
186
|
my %p = validate( @_, |
16
|
|
|
|
|
|
|
{ date => {type => OBJECT, |
17
|
|
|
|
|
|
|
isa => 'Gedcom::Date::Simple', |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
type => {type => SCALAR, |
20
|
|
|
|
|
|
|
regex => qr/(?ix)(?: ab(?:ou)?t | |
21
|
|
|
|
|
|
|
cal(?:culated)? | |
22
|
|
|
|
|
|
|
est(?:imated)? )/, |
23
|
|
|
|
|
|
|
default => 'ABT', |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
} ); |
26
|
|
|
|
|
|
|
|
27
|
11
|
|
|
|
|
232
|
my $type = uc $p{type}; |
28
|
11
|
50
|
|
|
|
36
|
if ($type eq 'ABOUT') { |
|
|
100
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
$type = 'ABT'; |
30
|
|
|
|
|
|
|
} elsif (length $type > 3) { |
31
|
10
|
|
|
|
|
19
|
$type = substr $type, 0, 3; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $self = { |
35
|
|
|
|
|
|
|
date => $p{date}->clone, |
36
|
11
|
|
|
|
|
32
|
abt => $type, |
37
|
|
|
|
|
|
|
}; |
38
|
11
|
|
|
|
|
90
|
return bless $self, $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub parse { |
42
|
32
|
|
|
32
|
1
|
30
|
my $class = shift; |
43
|
32
|
|
|
|
|
30
|
my ($str) = @_; |
44
|
|
|
|
|
|
|
|
45
|
32
|
100
|
|
|
|
216
|
my ($abt, $date) = $str =~ /^(ABT|CAL|EST) (.*)$/ |
46
|
|
|
|
|
|
|
or return; |
47
|
|
|
|
|
|
|
|
48
|
9
|
50
|
|
|
|
28
|
my $date_s = Gedcom::Date::Simple->parse($date) |
49
|
|
|
|
|
|
|
or return; |
50
|
|
|
|
|
|
|
|
51
|
9
|
|
|
|
|
23
|
my $self = bless { |
52
|
|
|
|
|
|
|
date => $date_s, |
53
|
|
|
|
|
|
|
abt => $abt |
54
|
|
|
|
|
|
|
}, $class; |
55
|
|
|
|
|
|
|
|
56
|
9
|
|
|
|
|
122
|
return $self; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub gedcom { |
60
|
14
|
|
|
14
|
1
|
573
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
14
|
50
|
|
|
|
71
|
if (!defined $self->{gedcom}) { |
63
|
14
|
|
|
|
|
40
|
$self->{gedcom} = $self->{abt} . ' ' . $self->{date}->gedcom(); |
64
|
|
|
|
|
|
|
} |
65
|
14
|
|
|
|
|
50
|
$self->{gedcom}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub latest { |
69
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
0
|
return $self->{date}->latest; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub earliest { |
75
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
0
|
return $self->{date}->earliest; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub sort_date { |
81
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
return $self->{date}->sort_date; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my %text = ( |
87
|
|
|
|
|
|
|
en => 'about %0', |
88
|
|
|
|
|
|
|
nl => 'rond %0', |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub text_format { |
92
|
9
|
|
|
9
|
0
|
13
|
my ($self, $lang) = @_; |
93
|
|
|
|
|
|
|
|
94
|
9
|
|
|
|
|
25
|
return ($text{$lang}, $self->{date}); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |