| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DateTime::Calendar::Coptic; |
|
2
|
1
|
|
|
1
|
|
792
|
use base qw( DateTime::Calendar::CopticEthiopic ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1533
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
1
|
|
|
|
|
85
|
use vars qw( |
|
7
|
|
|
|
|
|
|
$VERSION |
|
8
|
|
|
|
|
|
|
$n |
|
9
|
1
|
|
|
1
|
|
7
|
); |
|
|
1
|
|
|
|
|
1
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
2
|
$VERSION = "0.03"; |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
1035
|
require DateTime::Calendar::Coptic::Language; |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
require Convert::Number::Coptic; |
|
16
|
0
|
|
|
|
|
|
$n = new Convert::Number::Coptic; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
|
|
|
|
|
|
my $class = shift; |
|
23
|
|
|
|
|
|
|
my %args = @_ if ($#_); |
|
24
|
|
|
|
|
|
|
my $language = "cop"; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $self; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
if ( $args{language} ) { |
|
29
|
|
|
|
|
|
|
$language = $args{language}; |
|
30
|
|
|
|
|
|
|
delete ( $args{language} ); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
if ( $args{calscale} ) { |
|
33
|
|
|
|
|
|
|
if ( $args{calscale} =~ /gregorian/i ) { |
|
34
|
|
|
|
|
|
|
# |
|
35
|
|
|
|
|
|
|
# We have been given dates in the Gregorian system |
|
36
|
|
|
|
|
|
|
# so we must convert into Coptic |
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
my $dt = {}; bless $dt, $class; |
|
39
|
|
|
|
|
|
|
if ( $args{day} && $args{month} && $args{year} ) { |
|
40
|
|
|
|
|
|
|
( $args{day}, $args{month}, $args{year} ) |
|
41
|
|
|
|
|
|
|
= $dt->fromGregorian ( $args{day}, $args{month}, $args{year} ); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
else { |
|
44
|
|
|
|
|
|
|
die ( "Useless Gregorian context, no date args passed.\n" ); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
elsif ( $args{calscale} =~ /copticpic/i ) { |
|
48
|
|
|
|
|
|
|
$args{year} -= 276; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
delete ( $args{calscale} ); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$self = new DateTime ( %args ); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
if ( ref($language) ) { |
|
56
|
|
|
|
|
|
|
$self->{language} = $language; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
else { |
|
59
|
|
|
|
|
|
|
# print "Loading $language\n"; |
|
60
|
|
|
|
|
|
|
$self->{language} = DateTime::Calendar::Coptic::Language->new ( language => $language ); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $blessing = bless ( $self, $class ); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
$self->{rd} = $self->_EthiopicToAbsolute; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$blessing; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub from_object |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
|
|
|
|
|
|
my ( $class ) = shift; |
|
73
|
|
|
|
|
|
|
my %args = validate( @_, |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
|
|
|
|
|
|
object => { |
|
76
|
|
|
|
|
|
|
type => OBJECT, |
|
77
|
|
|
|
|
|
|
can => 'utc_rd_values', |
|
78
|
|
|
|
|
|
|
}, |
|
79
|
|
|
|
|
|
|
}, |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $object = $args{ object }->clone(); |
|
83
|
|
|
|
|
|
|
$object->set_time_zone( 'floating' ) if $object->can( 'set_time_zone' ); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my ( $rd, $rd_secs ) = $object->utc_rd_values(); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $self = bless( { rd => $rd, rd_secs => $rd_secs }, $class ); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$self; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub epoch |
|
94
|
|
|
|
|
|
|
{ |
|
95
|
|
|
|
|
|
|
103605; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub utc_rd_values |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
|
|
|
|
|
|
my ($self) = @_; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
( $self->{rd}, $self->{rd_secs} || 0 ); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# |
|
107
|
|
|
|
|
|
|
# calscale and toGregorian and are methods I recommend every non-Gregorian |
|
108
|
|
|
|
|
|
|
# based DateTime package provide to identify itself and to convert the |
|
109
|
|
|
|
|
|
|
# calendar system it handles into a normalized form. |
|
110
|
|
|
|
|
|
|
# |
|
111
|
|
|
|
|
|
|
sub calscale |
|
112
|
|
|
|
|
|
|
{ |
|
113
|
|
|
|
|
|
|
"coptic"; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub _sep |
|
118
|
|
|
|
|
|
|
{ |
|
119
|
|
|
|
|
|
|
", "; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _daysep |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
|
|
|
|
|
|
" exoou " |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub ad |
|
130
|
|
|
|
|
|
|
{ |
|
131
|
|
|
|
|
|
|
"AD" |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub full_date |
|
136
|
|
|
|
|
|
|
{ |
|
137
|
|
|
|
|
|
|
my ($self) = shift; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
(@_) |
|
140
|
|
|
|
|
|
|
? |
|
141
|
|
|
|
|
|
|
$self->day_name.$self->_sep.$self->month_name." ".$n->convert($self->day).$self->_daysep.$n->convert($self->year)." ".$self->ad |
|
142
|
|
|
|
|
|
|
: |
|
143
|
|
|
|
|
|
|
( $self->{_trans} ) |
|
144
|
|
|
|
|
|
|
? |
|
145
|
|
|
|
|
|
|
$self->day_name(@_).$self->_sep.$self->month_name(@_)." ".$self->day.$self->_daysep.$self->year." ".$self->ad(@_) |
|
146
|
|
|
|
|
|
|
: |
|
147
|
|
|
|
|
|
|
$self->day_name.$self->_sep.$self->month_name." ".$self->day.$self->_daysep.$n->convert($self->year)." ".$self->ad |
|
148
|
|
|
|
|
|
|
; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub long_date |
|
153
|
|
|
|
|
|
|
{ |
|
154
|
|
|
|
|
|
|
my ($self) = shift; |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
(@_) |
|
157
|
|
|
|
|
|
|
? |
|
158
|
|
|
|
|
|
|
$n->convert($self->day)."-".$self->month_name."-".$n->convert($self->year) |
|
159
|
|
|
|
|
|
|
: |
|
160
|
|
|
|
|
|
|
( $self->{_trans} ) |
|
161
|
|
|
|
|
|
|
? |
|
162
|
|
|
|
|
|
|
$self->day."-".$self->month_name(@_)."-".$self->year |
|
163
|
|
|
|
|
|
|
: |
|
164
|
|
|
|
|
|
|
$self->day."-".$self->month_name."-".$n->convert($self->year) |
|
165
|
|
|
|
|
|
|
; |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub medium_date |
|
170
|
|
|
|
|
|
|
{ |
|
171
|
|
|
|
|
|
|
my ($self) = @_; |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $year = $self->year; |
|
174
|
|
|
|
|
|
|
$year =~ s/^\d\d//; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
($#_) |
|
177
|
|
|
|
|
|
|
? |
|
178
|
|
|
|
|
|
|
$self->day."-".$self->month_name."-".$n->convert($year) |
|
179
|
|
|
|
|
|
|
: |
|
180
|
|
|
|
|
|
|
( $self->{_trans} ) |
|
181
|
|
|
|
|
|
|
? |
|
182
|
|
|
|
|
|
|
$self->day."-".$self->month_name(@_)."-".$year |
|
183
|
|
|
|
|
|
|
: |
|
184
|
|
|
|
|
|
|
$n->convert($self->day)."-".$self->month_name."-".$n->convert($year) |
|
185
|
|
|
|
|
|
|
; |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub useTranscription |
|
190
|
|
|
|
|
|
|
{ |
|
191
|
|
|
|
|
|
|
my $self = shift; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
$self->{_trans} = shift if (@_); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$self->{_trans}; |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
######################################################### |
|
200
|
|
|
|
|
|
|
# Do not change this, Do not put anything below this. |
|
201
|
|
|
|
|
|
|
# File must return "true" value at termination |
|
202
|
|
|
|
|
|
|
1; |
|
203
|
|
|
|
|
|
|
########################################################## |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
__END__ |