line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gedcom::Date::Period; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
40
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
353
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
38
|
use vars qw($VERSION @ISA); |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
569
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
8
|
|
|
|
|
|
|
@ISA = qw/Gedcom::Date/; |
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
40
|
use Gedcom::Date; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
3493
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub parse { |
13
|
50
|
|
|
50
|
1
|
71
|
my $class = shift; |
14
|
50
|
|
|
|
|
83
|
my ($str) = @_; |
15
|
|
|
|
|
|
|
|
16
|
50
|
|
|
|
|
62
|
my ($from, $to); |
17
|
50
|
100
|
|
|
|
276
|
if ($str =~ /^FROM (.*?) TO (.*)$/) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
18
|
3
|
50
|
|
|
|
23
|
$from = Gedcom::Date::Simple->parse($1) or return; |
19
|
3
|
50
|
|
|
|
21
|
$to = Gedcom::Date::Simple->parse($2) or return; |
20
|
|
|
|
|
|
|
} elsif ($str =~ /^FROM (.*)$/) { |
21
|
3
|
50
|
|
|
|
18
|
$from = Gedcom::Date::Simple->parse($1) or return; |
22
|
|
|
|
|
|
|
} elsif ($str =~ /^TO (.*)$/) { |
23
|
3
|
50
|
|
|
|
17
|
$to = Gedcom::Date::Simple->parse($1) or return; |
24
|
|
|
|
|
|
|
} else { |
25
|
41
|
|
|
|
|
330
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
9
|
|
|
|
|
47
|
my $self = bless { |
29
|
|
|
|
|
|
|
from => $from, |
30
|
|
|
|
|
|
|
to => $to |
31
|
|
|
|
|
|
|
}, $class; |
32
|
|
|
|
|
|
|
|
33
|
9
|
|
|
|
|
290
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub gedcom { |
37
|
6
|
|
|
6
|
1
|
1676
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
6
|
50
|
|
|
|
28
|
if (!defined $self->{gedcom}) { |
40
|
12
|
100
|
|
|
|
70
|
$self->{gedcom} = join ' ', |
41
|
6
|
|
|
|
|
52
|
map {defined $self->{$_} ? |
42
|
|
|
|
|
|
|
(uc, $self->{$_}->gedcom()) : |
43
|
|
|
|
|
|
|
() |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
qw/from to/; |
46
|
|
|
|
|
|
|
} |
47
|
6
|
|
|
|
|
42
|
$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
|
18
|
my ($self, $lang) = @_; |
75
|
9
|
|
50
|
|
|
34
|
$lang ||= 'en'; |
76
|
|
|
|
|
|
|
|
77
|
9
|
100
|
|
|
|
54
|
my $type = defined($self->{to}) ? |
|
|
100
|
|
|
|
|
|
78
|
|
|
|
|
|
|
(defined($self->{from}) ? 2 : 1 ) : 0; |
79
|
9
|
|
|
|
|
63
|
return ($text{$lang}[$type], $self->{from}, $self->{to}); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |