line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gedcom::Date::Period; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
28
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
181
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
30
|
use vars qw($VERSION @ISA); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
422
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
8
|
|
|
|
|
|
|
@ISA = qw/Gedcom::Date/; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
30
|
use Gedcom::Date; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
3106
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub parse { |
13
|
50
|
|
|
50
|
1
|
77
|
my $class = shift; |
14
|
50
|
|
|
|
|
72
|
my ($str) = @_; |
15
|
|
|
|
|
|
|
|
16
|
50
|
|
|
|
|
65
|
my ($from, $to); |
17
|
50
|
100
|
|
|
|
274
|
if ($str =~ /^FROM (.*?) TO (.*)$/) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
18
|
3
|
50
|
|
|
|
15
|
$from = Gedcom::Date::Simple->parse($1) or return; |
19
|
3
|
50
|
|
|
|
14
|
$to = Gedcom::Date::Simple->parse($2) or return; |
20
|
|
|
|
|
|
|
} elsif ($str =~ /^FROM (.*)$/) { |
21
|
3
|
50
|
|
|
|
15
|
$from = Gedcom::Date::Simple->parse($1) or return; |
22
|
|
|
|
|
|
|
} elsif ($str =~ /^TO (.*)$/) { |
23
|
3
|
50
|
|
|
|
16
|
$to = Gedcom::Date::Simple->parse($1) or return; |
24
|
|
|
|
|
|
|
} else { |
25
|
41
|
|
|
|
|
265
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
9
|
|
|
|
|
30
|
my $self = bless { |
29
|
|
|
|
|
|
|
from => $from, |
30
|
|
|
|
|
|
|
to => $to |
31
|
|
|
|
|
|
|
}, $class; |
32
|
|
|
|
|
|
|
|
33
|
9
|
|
|
|
|
216
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub gedcom { |
37
|
6
|
|
|
6
|
1
|
1461
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
6
|
50
|
|
|
|
24
|
if (!defined $self->{gedcom}) { |
40
|
|
|
|
|
|
|
$self->{gedcom} = join ' ', |
41
|
6
|
|
|
|
|
13
|
map {defined $self->{$_} ? |
42
|
12
|
100
|
|
|
|
57
|
(uc, $self->{$_}->gedcom()) : |
43
|
|
|
|
|
|
|
() |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
qw/from to/; |
46
|
|
|
|
|
|
|
} |
47
|
6
|
|
|
|
|
34
|
$self->{gedcom}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub earliest { |
51
|
0
|
|
|
0
|
1
|
0
|
return DateTime::Infinite::Past->new; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub latest { |
55
|
0
|
|
|
0
|
1
|
0
|
return DateTime::Infinite::Future->new; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub sort_date { |
59
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
0
|
if (defined $self->{from}) { |
62
|
0
|
|
|
|
|
0
|
return $self->{from}->sort_date; |
63
|
|
|
|
|
|
|
} else { |
64
|
0
|
|
|
|
|
0
|
return $self->{to}->sort_date; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my %text = ( |
69
|
|
|
|
|
|
|
en => ['from %0', 'to %1', 'from %0 to %1'], |
70
|
|
|
|
|
|
|
nl => ['vanaf %0', 'tot %1', 'van %0 tot %1'], |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub text_format { |
74
|
9
|
|
|
9
|
0
|
38
|
my ($self, $lang) = @_; |
75
|
9
|
|
50
|
|
|
24
|
$lang ||= 'en'; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $type = defined($self->{to}) ? |
78
|
9
|
100
|
|
|
|
32
|
(defined($self->{from}) ? 2 : 1 ) : 0; |
|
|
100
|
|
|
|
|
|
79
|
9
|
|
|
|
|
36
|
return ($text{$lang}[$type], $self->{from}, $self->{to}); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |