| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DateTime::Calendar::Coptic; |
|
2
|
1
|
|
|
1
|
|
368277
|
use base qw( DateTime::Calendar::CopticEthiopic ); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
784
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
8
|
1
|
|
|
|
|
59
|
use vars qw( |
|
9
|
|
|
|
|
|
|
$VERSION |
|
10
|
|
|
|
|
|
|
$n |
|
11
|
1
|
|
|
1
|
|
3
|
); |
|
|
1
|
|
|
|
|
2
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
3
|
$VERSION = "0.05"; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
483
|
require DateTime::Calendar::Coptic::Languages; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
510
|
require Convert::Number::Coptic; |
|
18
|
1
|
|
|
|
|
1000
|
$n = new Convert::Number::Coptic; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
2
|
|
|
2
|
1
|
1456
|
my $class = shift; |
|
25
|
2
|
50
|
|
|
|
11
|
my %args = @_ if ($#_); |
|
26
|
2
|
|
|
|
|
3
|
my $language = "cop"; |
|
27
|
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
2
|
my $self; |
|
29
|
|
|
|
|
|
|
|
|
30
|
2
|
50
|
|
|
|
5
|
if ( $args{language} ) { |
|
31
|
0
|
|
|
|
|
0
|
$language = $args{language}; |
|
32
|
0
|
|
|
|
|
0
|
delete ( $args{language} ); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
2
|
100
|
|
|
|
3
|
if ( $args{calscale} ) { |
|
35
|
1
|
50
|
|
|
|
5
|
if ( $args{calscale} =~ /gregorian/i ) { |
|
|
|
0
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# |
|
37
|
|
|
|
|
|
|
# We have been given dates in the Gregorian system |
|
38
|
|
|
|
|
|
|
# so we must convert into Coptic |
|
39
|
|
|
|
|
|
|
# |
|
40
|
1
|
|
|
|
|
2
|
my $dt = {}; bless $dt, $class; |
|
|
1
|
|
|
|
|
2
|
|
|
41
|
1
|
50
|
33
|
|
|
8
|
if ( $args{day} && $args{month} && $args{year} ) { |
|
|
|
|
33
|
|
|
|
|
|
42
|
|
|
|
|
|
|
( $args{day}, $args{month}, $args{year} ) |
|
43
|
1
|
|
|
|
|
7
|
= $dt->fromGregorian ( $args{day}, $args{month}, $args{year} ); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
else { |
|
46
|
0
|
|
|
|
|
0
|
die ( "Useless Gregorian context, no date args passed.\n" ); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
elsif ( $args{calscale} =~ /copticpic/i ) { |
|
50
|
0
|
|
|
|
|
0
|
$args{year} -= 276; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
1
|
|
|
|
|
1
|
delete ( $args{calscale} ); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
2
|
|
|
|
|
10
|
$self = new DateTime ( %args ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
2
|
50
|
|
|
|
629
|
if ( ref($language) ) { |
|
58
|
0
|
|
|
|
|
0
|
$self->{language} = $language; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
else { |
|
61
|
|
|
|
|
|
|
# print "Loading $language\n"; |
|
62
|
2
|
|
|
|
|
15
|
$self->{language} = DateTime::Calendar::Coptic::Languages->new ( language => $language ); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
4
|
my $blessing = bless ( $self, $class ); |
|
66
|
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
10
|
$self->{rd} = $self->_EthiopicToAbsolute; |
|
68
|
|
|
|
|
|
|
|
|
69
|
2
|
|
|
|
|
12
|
$blessing; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub from_object |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
0
|
|
|
0
|
1
|
0
|
my ( $class ) = shift; |
|
75
|
0
|
|
|
|
|
0
|
my %args = validate( @_, |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
|
|
|
|
|
|
object => { |
|
78
|
|
|
|
|
|
|
type => OBJECT, |
|
79
|
|
|
|
|
|
|
can => 'utc_rd_values', |
|
80
|
|
|
|
|
|
|
}, |
|
81
|
|
|
|
|
|
|
}, |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
0
|
my $object = $args{ object }->clone(); |
|
85
|
0
|
0
|
|
|
|
0
|
$object->set_time_zone( 'floating' ) if $object->can( 'set_time_zone' ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
0
|
my ( $rd, $rd_secs ) = $object->utc_rd_values(); |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
0
|
my $self = bless( { rd => $rd, rd_secs => $rd_secs }, $class ); |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
$self; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub epoch |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
6
|
|
|
6
|
1
|
14
|
103605; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub utc_rd_values |
|
101
|
|
|
|
|
|
|
{ |
|
102
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
0
|
|
|
|
( $self->{rd}, $self->{rd_secs} || 0 ); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# |
|
109
|
|
|
|
|
|
|
# calscale and toGregorian and are methods I recommend every non-Gregorian |
|
110
|
|
|
|
|
|
|
# based DateTime package provide to identify itself and to convert the |
|
111
|
|
|
|
|
|
|
# calendar system it handles into a normalized form. |
|
112
|
|
|
|
|
|
|
# |
|
113
|
|
|
|
|
|
|
sub calscale |
|
114
|
|
|
|
|
|
|
{ |
|
115
|
0
|
|
|
0
|
0
|
|
"coptic"; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub _sep |
|
120
|
|
|
|
|
|
|
{ |
|
121
|
0
|
|
|
0
|
|
|
", "; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub _daysep |
|
126
|
|
|
|
|
|
|
{ |
|
127
|
0
|
|
|
0
|
|
|
" exoou " |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub ad |
|
132
|
|
|
|
|
|
|
{ |
|
133
|
0
|
|
|
0
|
0
|
|
"AD" |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub full_date |
|
138
|
|
|
|
|
|
|
{ |
|
139
|
0
|
|
|
0
|
0
|
|
my ($self) = shift; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
(@_) |
|
142
|
|
|
|
|
|
|
? |
|
143
|
|
|
|
|
|
|
$self->day_name.$self->_sep.$self->month_name." ".$n->convert($self->day).$self->_daysep.$n->convert($self->year)." ".$self->ad |
|
144
|
|
|
|
|
|
|
: |
|
145
|
|
|
|
|
|
|
( $self->{_trans} ) |
|
146
|
0
|
0
|
|
|
|
|
? |
|
|
|
0
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
$self->day_name(@_).$self->_sep.$self->month_name(@_)." ".$self->day.$self->_daysep.$self->year." ".$self->ad(@_) |
|
148
|
|
|
|
|
|
|
: |
|
149
|
|
|
|
|
|
|
$self->day_name.$self->_sep.$self->month_name." ".$self->day.$self->_daysep.$n->convert($self->year)." ".$self->ad |
|
150
|
|
|
|
|
|
|
; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub long_date |
|
155
|
|
|
|
|
|
|
{ |
|
156
|
0
|
|
|
0
|
0
|
|
my ($self) = shift; |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
(@_) |
|
159
|
|
|
|
|
|
|
? |
|
160
|
|
|
|
|
|
|
$n->convert($self->day)."-".$self->month_name."-".$n->convert($self->year) |
|
161
|
|
|
|
|
|
|
: |
|
162
|
|
|
|
|
|
|
( $self->{_trans} ) |
|
163
|
0
|
0
|
|
|
|
|
? |
|
|
|
0
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$self->day."-".$self->month_name(@_)."-".$self->year |
|
165
|
|
|
|
|
|
|
: |
|
166
|
|
|
|
|
|
|
$self->day."-".$self->month_name."-".$n->convert($self->year) |
|
167
|
|
|
|
|
|
|
; |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub medium_date |
|
172
|
|
|
|
|
|
|
{ |
|
173
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
174
|
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
my $year = $self->year; |
|
176
|
0
|
|
|
|
|
|
$year =~ s/^\d\d//; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
($#_) |
|
179
|
|
|
|
|
|
|
? |
|
180
|
|
|
|
|
|
|
$self->day."-".$self->month_name."-".$n->convert($year) |
|
181
|
|
|
|
|
|
|
: |
|
182
|
|
|
|
|
|
|
( $self->{_trans} ) |
|
183
|
0
|
0
|
|
|
|
|
? |
|
|
|
0
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
$self->day."-".$self->month_name(@_)."-".$year |
|
185
|
|
|
|
|
|
|
: |
|
186
|
|
|
|
|
|
|
$n->convert($self->day)."-".$self->month_name."-".$n->convert($year) |
|
187
|
|
|
|
|
|
|
; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub useTranscription |
|
192
|
|
|
|
|
|
|
{ |
|
193
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
194
|
|
|
|
|
|
|
|
|
195
|
0
|
0
|
|
|
|
|
$self->{_trans} = shift if (@_); |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
$self->{_trans}; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
######################################################### |
|
202
|
|
|
|
|
|
|
# Do not change this, Do not put anything below this. |
|
203
|
|
|
|
|
|
|
# File must return "true" value at termination |
|
204
|
|
|
|
|
|
|
1; |
|
205
|
|
|
|
|
|
|
########################################################## |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
__END__ |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head1 NAME |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
DateTime::Calendar::Coptic - DateTime Module for the Coptic Calendar System. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
use DateTime::Calendar::Coptic; |
|
218
|
|
|
|
|
|
|
# |
|
219
|
|
|
|
|
|
|
# typical instantiation: |
|
220
|
|
|
|
|
|
|
# |
|
221
|
|
|
|
|
|
|
my $coptic = new DateTime::Calendar::Coptic ( day => 28, month => 7, year => 1719 ); |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
# |
|
224
|
|
|
|
|
|
|
# Get Gregorian Date: |
|
225
|
|
|
|
|
|
|
# |
|
226
|
|
|
|
|
|
|
my ($d,$m,$y) = $coptic->gregorian; |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
# |
|
229
|
|
|
|
|
|
|
# instantiate with a Gregorian date, date will be converted. |
|
230
|
|
|
|
|
|
|
# |
|
231
|
|
|
|
|
|
|
$coptic = new DateTime::Calendar::Coptic ( day => 5, month => 4, year => 2003, calscale => 'gregorian' ); |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
# |
|
234
|
|
|
|
|
|
|
# get a DateTime object in the Gregorian calendar system |
|
235
|
|
|
|
|
|
|
# |
|
236
|
|
|
|
|
|
|
my $grego = $coptic->toGregorian; |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
The DateTime::Calendar::Coptic module provides methods for accessing date information |
|
241
|
|
|
|
|
|
|
in the Coptic calendar system. The module will also convert dates to |
|
242
|
|
|
|
|
|
|
and from the Gregorian system. |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 CREDITS |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
L<http://www.copticchurch.net/easter.html> |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head1 REQUIRES |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
DateTime and L<Convert::Number::Coptic>. It should work with |
|
251
|
|
|
|
|
|
|
any version of Perl. L<Convert::Number::Coptic> is only required |
|
252
|
|
|
|
|
|
|
if you want to display years and days in Coptic numerals. |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head1 BUGS |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
None presently yet. |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head1 AUTHOR |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Daniel Yacob, L<dyacob@cpan.org|mailto:dyacob@cpan.org> |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Copyright (c) 2003-2025, Daniel Yacob C<< <dyacob@cpan.org> >>. All rights reserved. |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
|
271
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L<perlartistic>. |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
L<DateTime> |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=cut |