line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DateTime::Calendar::Pataphysical; |
2
|
|
|
|
|
|
|
$DateTime::Calendar::Pataphysical::VERSION = '0.07'; |
3
|
11
|
|
|
11
|
|
1659360
|
use strict; |
|
11
|
|
|
|
|
128
|
|
|
11
|
|
|
|
|
356
|
|
4
|
11
|
|
|
11
|
|
61
|
use warnings; |
|
11
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
312
|
|
5
|
11
|
|
|
11
|
|
6598
|
use utf8; |
|
11
|
|
|
|
|
158
|
|
|
11
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
6078
|
use DateTime::Duration; |
|
11
|
|
|
|
|
5663403
|
|
|
11
|
|
|
|
|
456
|
|
8
|
11
|
|
|
11
|
|
117
|
use DateTime::Locale; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
297
|
|
9
|
11
|
|
|
11
|
|
7784
|
use Params::Validate qw/validate SCALAR OBJECT/; |
|
11
|
|
|
|
|
33960
|
|
|
11
|
|
|
|
|
1815
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _floor { |
12
|
2865
|
|
|
2865
|
|
4349
|
my $x = shift; |
13
|
2865
|
|
|
|
|
4773
|
my $ix = int $x; |
14
|
2865
|
100
|
|
|
|
5220
|
if ($ix <= $x) { |
15
|
1646
|
|
|
|
|
3598
|
return $ix; |
16
|
|
|
|
|
|
|
} else { |
17
|
1219
|
|
|
|
|
2460
|
return $ix - 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
11
|
|
|
|
|
84
|
use overload ( 'fallback' => 1, |
22
|
|
|
|
|
|
|
'<=>' => '_compare_overload', |
23
|
|
|
|
|
|
|
'cmp' => '_compare_overload', |
24
|
|
|
|
|
|
|
'-' => '_subtract_overload', |
25
|
|
|
|
|
|
|
'+' => '_add_overload', |
26
|
11
|
|
|
11
|
|
113
|
); |
|
11
|
|
|
|
|
38
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
my $DefaultLocale; |
30
|
|
|
|
|
|
|
sub DefaultLocale { |
31
|
760
|
|
|
760
|
0
|
1424
|
my $class = shift; |
32
|
|
|
|
|
|
|
|
33
|
760
|
100
|
|
|
|
2013
|
if (@_) { |
34
|
11
|
|
|
|
|
34
|
my $lang = shift; |
35
|
|
|
|
|
|
|
|
36
|
11
|
|
|
|
|
147
|
DateTime::Locale->load($lang); |
37
|
|
|
|
|
|
|
|
38
|
11
|
|
|
|
|
1954
|
$DefaultLocale = $lang; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
760
|
|
|
|
|
18944
|
return $DefaultLocale; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
__PACKAGE__->DefaultLocale('French'); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
407
|
|
|
407
|
1
|
33564
|
my $class = shift; |
48
|
407
|
|
|
|
|
2639
|
my %p = validate( @_, |
49
|
|
|
|
|
|
|
{ year => {type => SCALAR}, |
50
|
|
|
|
|
|
|
month => {type => SCALAR, default => 1}, |
51
|
|
|
|
|
|
|
day => {type => SCALAR, default => 1}, |
52
|
|
|
|
|
|
|
rd_secs => { type => SCALAR, default => 0}, |
53
|
|
|
|
|
|
|
rd_nano => { type => SCALAR, default => 0}, |
54
|
|
|
|
|
|
|
locale => { type => SCALAR | OBJECT, |
55
|
|
|
|
|
|
|
default => $class->DefaultLocale }, |
56
|
|
|
|
|
|
|
} ); |
57
|
|
|
|
|
|
|
|
58
|
407
|
|
|
|
|
3186
|
my $self = bless \%p, $class; |
59
|
|
|
|
|
|
|
$self->{locale} = DateTime::Locale->load($p{locale}) |
60
|
407
|
100
|
|
|
|
2586
|
unless (ref $self->{locale}); |
61
|
|
|
|
|
|
|
|
62
|
407
|
|
|
|
|
41927
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub clone { |
66
|
102
|
|
|
102
|
1
|
388
|
my $self = shift; |
67
|
|
|
|
|
|
|
|
68
|
102
|
|
|
|
|
609
|
return bless {%$self}, ref $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub set |
72
|
|
|
|
|
|
|
{ |
73
|
6
|
|
|
6
|
1
|
1598
|
my $self = shift; |
74
|
6
|
|
|
|
|
155
|
my %p = validate( @_, |
75
|
|
|
|
|
|
|
{ year => { type => SCALAR, optional => 1 }, |
76
|
|
|
|
|
|
|
month => { type => SCALAR, optional => 1 }, |
77
|
|
|
|
|
|
|
day => { type => SCALAR, optional => 1 }, |
78
|
|
|
|
|
|
|
locale => { type => SCALAR | OBJECT, optional => 1 }, |
79
|
|
|
|
|
|
|
} ); |
80
|
|
|
|
|
|
|
|
81
|
6
|
100
|
100
|
|
|
57
|
if (exists $p{locale} && ! ref $p{locale}) { |
82
|
|
|
|
|
|
|
$p{locale} = DateTime::Locale->load($p{locale}) |
83
|
2
|
|
|
|
|
11
|
} |
84
|
|
|
|
|
|
|
|
85
|
6
|
|
|
|
|
224
|
$self->{$_} = $p{$_} for keys %p; |
86
|
6
|
|
|
|
|
19
|
return $self; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub truncate { |
90
|
3
|
|
|
3
|
1
|
12
|
my $self = shift; |
91
|
3
|
|
|
|
|
57
|
my %p = validate( @_, |
92
|
|
|
|
|
|
|
{ to => |
93
|
|
|
|
|
|
|
{ regex => qr/^(?:year|month|day)$/ }, |
94
|
|
|
|
|
|
|
}, |
95
|
|
|
|
|
|
|
); |
96
|
3
|
|
|
|
|
58
|
foreach my $f ( qw( day month year ) ) { |
97
|
6
|
100
|
|
|
|
20
|
last if $p{to} eq $f; |
98
|
3
|
|
|
|
|
8
|
$self->{$f} = 1; |
99
|
|
|
|
|
|
|
} |
100
|
3
|
|
|
|
|
8
|
return $self; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
0
|
0
|
0
|
sub locale { $_[0]->{locale} } |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub is_leap_year { |
106
|
16
|
|
|
16
|
1
|
31
|
my $self = shift; |
107
|
16
|
|
|
|
|
37
|
my $year = $self->{year}; |
108
|
16
|
50
|
|
|
|
76
|
$year++ if $year < 0; |
109
|
16
|
100
|
100
|
|
|
100
|
if ($year % 4 != 3 or ($year % 100 == 27 and $year % 400 != 127)) { |
|
|
|
100
|
|
|
|
|
110
|
8
|
|
|
|
|
47
|
return 0; |
111
|
|
|
|
|
|
|
} else { |
112
|
8
|
|
|
|
|
42
|
return 1; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
229
|
|
|
229
|
1
|
2065
|
sub year { $_[0]->{year} } |
117
|
|
|
|
|
|
|
|
118
|
218
|
|
|
218
|
1
|
708
|
sub month { $_[0]->{month} } |
119
|
|
|
|
|
|
|
*mon = \&month; |
120
|
|
|
|
|
|
|
|
121
|
1
|
|
|
1
|
0
|
12
|
sub month_0 { $_[0]->{month}-1 } |
122
|
|
|
|
|
|
|
*mon_0 = \&month_0; |
123
|
|
|
|
|
|
|
|
124
|
219
|
|
|
219
|
1
|
703
|
sub day_of_month { $_[0]->{day} } |
125
|
|
|
|
|
|
|
*day = \&day_of_month; |
126
|
|
|
|
|
|
|
*mday = \&day_of_month; |
127
|
|
|
|
|
|
|
|
128
|
1
|
|
|
1
|
0
|
6
|
sub day_of_month_0 { $_[0]->{day} - 1 } |
129
|
|
|
|
|
|
|
*day_0 = \&day_of_month_0; |
130
|
|
|
|
|
|
|
*mday_0 = \&day_of_month_0; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub month_name { |
133
|
|
|
|
|
|
|
return (qw/Absolu Haha As Sable Décervelage Gueules Pédale Clinamen |
134
|
5
|
|
|
5
|
1
|
48
|
Palotin Merdre Gidouille Tatane Phalle/)[$_[0]->{month}-1]; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub day_of_week { |
138
|
8
|
|
|
8
|
1
|
21
|
my $self = shift; |
139
|
|
|
|
|
|
|
|
140
|
8
|
100
|
|
|
|
29
|
if ($self->{day} == 29) { |
141
|
4
|
|
|
|
|
26
|
return undef; |
142
|
|
|
|
|
|
|
} else { |
143
|
4
|
|
|
|
|
31
|
return 1 + ($self->{day}-1) % 7; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub day_of_week_0 { |
148
|
10
|
|
|
10
|
0
|
51
|
my $self = shift; |
149
|
|
|
|
|
|
|
|
150
|
10
|
100
|
|
|
|
32
|
if ($self->{day} == 29) { |
151
|
1
|
|
|
|
|
5
|
return undef; |
152
|
|
|
|
|
|
|
} else { |
153
|
9
|
|
|
|
|
78
|
return +($self->{day}-1) % 7; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub day_name { |
158
|
11
|
|
|
11
|
1
|
51
|
my $self = shift; |
159
|
|
|
|
|
|
|
|
160
|
11
|
100
|
|
|
|
34
|
if ($self->{day} == 29) { |
161
|
4
|
|
|
|
|
10
|
my $name = 'hunyadi'; |
162
|
4
|
|
|
|
|
16
|
my $n = $self->{locale}->day_format_wide->[0]; |
163
|
4
|
100
|
|
|
|
36
|
$name = ucfirst $name if $n eq ucfirst $n; |
164
|
4
|
|
|
|
|
23
|
return $name; |
165
|
|
|
|
|
|
|
} else { |
166
|
7
|
|
100
|
|
|
28
|
return $self->{locale}->day_format_wide->[($self->day_of_week_0 || 7)-1]; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub week_number { |
171
|
9
|
|
|
9
|
1
|
18
|
my $self = shift; |
172
|
|
|
|
|
|
|
|
173
|
9
|
100
|
|
|
|
29
|
if ($self->{day} == 29) { |
174
|
5
|
|
|
|
|
20
|
return undef; |
175
|
|
|
|
|
|
|
} else { |
176
|
4
|
|
|
|
|
28
|
return 4*($self->{month} - 1) + int(($self->{day} - 1)/7) + 1; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
3
|
|
|
3
|
1
|
14
|
sub week_year { $_[0]->year } |
181
|
|
|
|
|
|
|
|
182
|
3
|
|
|
3
|
1
|
12
|
sub week { $_[0]->week_year, $_[0]->week_number } |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub day_of_year { |
185
|
5
|
|
|
5
|
1
|
13
|
my $self = shift; |
186
|
|
|
|
|
|
|
|
187
|
5
|
|
|
|
|
30
|
return $self->{day} + ($self->{month}-1) * 29; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub day_of_year_0 { |
191
|
10
|
|
|
10
|
0
|
24
|
my $self = shift; |
192
|
|
|
|
|
|
|
|
193
|
10
|
|
|
|
|
75
|
return $self->{day} + ($self->{month}-1) * 29 - 1; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub ymd { |
197
|
193
|
|
|
193
|
1
|
17928
|
my ($self, $sep) = @_; |
198
|
193
|
100
|
|
|
|
513
|
$sep = '-' unless defined $sep; |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
return sprintf( "%0.3d%s%0.2d%s%0.2d", |
201
|
|
|
|
|
|
|
$self->{year}, $sep, |
202
|
|
|
|
|
|
|
$self->{month}, $sep, |
203
|
193
|
|
|
|
|
1672
|
$self->{day} ); |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
*date = \&ymd; |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub mdy { |
208
|
2
|
|
|
2
|
1
|
7
|
my ($self, $sep) = @_; |
209
|
2
|
100
|
|
|
|
7
|
$sep = '-' unless defined $sep; |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
return sprintf( "%0.2d%s%0.2d%s%0.3d", |
212
|
|
|
|
|
|
|
$self->{month}, $sep, |
213
|
|
|
|
|
|
|
$self->{day}, $sep, |
214
|
2
|
|
|
|
|
20
|
$self->{year} ); |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
sub dmy { |
217
|
2
|
|
|
2
|
1
|
7
|
my ($self, $sep) = @_; |
218
|
2
|
100
|
|
|
|
8
|
$sep = '-' unless defined $sep; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
return sprintf( "%0.2d%s%0.2d%s%0.3d", |
221
|
|
|
|
|
|
|
$self->{day}, $sep, |
222
|
|
|
|
|
|
|
$self->{month}, $sep, |
223
|
2
|
|
|
|
|
21
|
$self->{year} ); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub datetime { |
227
|
35
|
|
|
35
|
1
|
19663
|
my $self = shift; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# EP = Ere Pataphysique |
230
|
35
|
|
|
|
|
93
|
return $self->ymd() . 'EP'; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
my %formats = |
234
|
|
|
|
|
|
|
( 'A' => sub { $_[0]->day_name }, |
235
|
|
|
|
|
|
|
'B' => sub { $_[0]->month_name }, |
236
|
|
|
|
|
|
|
'C' => sub { int( $_[0]->year / 100 ) }, |
237
|
|
|
|
|
|
|
'd' => sub { sprintf( '%02d', $_[0]->day_of_month ) }, |
238
|
|
|
|
|
|
|
'D' => sub { $_[0]->strftime( '%m/%d/%y' ) }, |
239
|
|
|
|
|
|
|
'e' => sub { sprintf( '%2d', $_[0]->day_of_month ) }, |
240
|
|
|
|
|
|
|
'F' => sub { $_[0]->ymd('-') }, |
241
|
|
|
|
|
|
|
'j' => sub { $_[0]->day_of_year }, |
242
|
|
|
|
|
|
|
'm' => sub { sprintf( '%02d', $_[0]->month ) }, |
243
|
|
|
|
|
|
|
'n' => sub { "\n" }, |
244
|
|
|
|
|
|
|
't' => sub { "\t" }, |
245
|
|
|
|
|
|
|
'u' => sub { $_[0]->day_of_week || 'H' }, |
246
|
|
|
|
|
|
|
'U' => sub { my $w = $_[0]->week_number; |
247
|
|
|
|
|
|
|
defined $w ? sprintf('%02d', $w) : ' ' }, |
248
|
|
|
|
|
|
|
'w' => sub { my $dow = $_[0]->day_of_week; |
249
|
|
|
|
|
|
|
defined $dow ? $dow-1 : 'H' }, |
250
|
|
|
|
|
|
|
'y' => sub { sprintf( '%02d', substr( $_[0]->year, -2 ) ) }, |
251
|
|
|
|
|
|
|
'Y' => sub { return $_[0]->year }, |
252
|
|
|
|
|
|
|
'%' => sub { '%' }, |
253
|
|
|
|
|
|
|
'*' => sub { $_[0]->feast }, |
254
|
|
|
|
|
|
|
); |
255
|
|
|
|
|
|
|
$formats{W} = $formats{V} = $formats{U}; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub strftime { |
258
|
41
|
|
|
41
|
1
|
25686
|
my ($self, @r) = @_; |
259
|
|
|
|
|
|
|
|
260
|
41
|
|
|
|
|
124
|
foreach (@r) { |
261
|
42
|
100
|
|
|
|
231
|
s/%([%*A-Za-z])/ $formats{$1} ? $formats{$1}->($self) : $1 /ge; |
|
45
|
|
|
|
|
274
|
|
262
|
42
|
100
|
|
|
|
253
|
return $_ unless wantarray; |
263
|
|
|
|
|
|
|
} |
264
|
1
|
|
|
|
|
6
|
return @r; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
sub last_day_of_month { |
268
|
6
|
|
|
6
|
1
|
132
|
my $class = shift; |
269
|
6
|
|
|
|
|
166
|
my %p = validate( @_, |
270
|
|
|
|
|
|
|
{ year => { type => SCALAR }, |
271
|
|
|
|
|
|
|
month => { type => SCALAR }, |
272
|
|
|
|
|
|
|
locale => { type => SCALAR | OBJECT, optional => 1 }, |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
); |
275
|
6
|
|
|
|
|
42
|
$p{day} = 29; |
276
|
6
|
|
|
|
|
31
|
return $class->new(%p); |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub is_imaginary { |
280
|
289
|
|
|
289
|
1
|
479
|
my $self = shift; |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
return $self->{day} == 29 && $self->{month} != 11 && |
283
|
289
|
|
66
|
|
|
1396
|
($self->{month} != 6 or !$self->is_leap_year); |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub utc_rd_values { |
287
|
284
|
|
|
284
|
1
|
16735
|
my $self = shift; |
288
|
|
|
|
|
|
|
|
289
|
284
|
100
|
|
|
|
734
|
return if $self->is_imaginary; |
290
|
|
|
|
|
|
|
|
291
|
270
|
|
|
|
|
553
|
my ($year, $month, $day) = @{$self}{qw/year month day/}; |
|
270
|
|
|
|
|
714
|
|
292
|
270
|
100
|
|
|
|
630
|
$year++ if $year < 0; |
293
|
|
|
|
|
|
|
|
294
|
270
|
|
|
|
|
444
|
my $cyear = $year; |
295
|
270
|
100
|
|
|
|
605
|
$cyear++ if $month > 6; |
296
|
270
|
100
|
|
|
|
561
|
$day++ if $month > 11; |
297
|
|
|
|
|
|
|
|
298
|
270
|
|
|
|
|
877
|
my $rd = 683984 + # 7 September 1873 = 28 Phalle '0' |
299
|
|
|
|
|
|
|
($year-1) * 365 + # normal years: 365 real days |
300
|
|
|
|
|
|
|
_floor( .25 * $cyear) - # leap years |
301
|
|
|
|
|
|
|
_floor(($cyear+72)/100) + # century years |
302
|
|
|
|
|
|
|
_floor(($cyear+272)/400 ) + |
303
|
|
|
|
|
|
|
+ ($month - 1) * 28 + $day; |
304
|
270
|
|
|
|
|
919
|
return ($rd, $self->{rd_secs}, $self->{rd_nano}); |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub utc_rd_as_seconds { |
308
|
41
|
|
|
41
|
1
|
32640
|
my $self = shift; |
309
|
41
|
|
|
|
|
106
|
my ($rd_days, $rd_secs, $rd_nano) = $self->utc_rd_values; |
310
|
|
|
|
|
|
|
|
311
|
41
|
100
|
|
|
|
93
|
if (defined $rd_days) { |
312
|
34
|
|
|
|
|
147
|
return $rd_days*24*60*60 + $rd_secs + $rd_nano * 1e-9; |
313
|
|
|
|
|
|
|
} else { |
314
|
7
|
|
|
|
|
32
|
return undef; |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
sub from_object { |
319
|
237
|
|
|
237
|
1
|
133949
|
my $class = shift; |
320
|
237
|
|
|
|
|
1254
|
my %p = validate( @_, |
321
|
|
|
|
|
|
|
{ object => { type => OBJECT, |
322
|
|
|
|
|
|
|
can => 'utc_rd_values', |
323
|
|
|
|
|
|
|
}, |
324
|
|
|
|
|
|
|
locale => { type => SCALAR | OBJECT, |
325
|
|
|
|
|
|
|
default => $class->DefaultLocale }, |
326
|
|
|
|
|
|
|
}, |
327
|
|
|
|
|
|
|
); |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
$p{object} = $p{object}->clone->set_time_zone( 'floating' ) |
330
|
237
|
100
|
|
|
|
2118
|
if $p{object}->can( 'set_time_zone' ); |
331
|
|
|
|
|
|
|
|
332
|
237
|
|
|
|
|
21493
|
my ( $rd_days, $rd_secs, $rd_nano ) = $p{object}->utc_rd_values; |
333
|
|
|
|
|
|
|
|
334
|
237
|
|
|
|
|
1795
|
my ($y, $m, $d) = $class->_rd2ymd( $rd_days ); |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
return $class->new( year => $y, month => $m, day => $d, |
337
|
|
|
|
|
|
|
rd_secs => $rd_secs||0, rd_nano => $rd_nano||0, |
338
|
237
|
|
100
|
|
|
1487
|
locale => $p{locale} ); |
|
|
|
50
|
|
|
|
|
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub _rd2ymd { |
342
|
342
|
|
|
342
|
|
782
|
my ($class, $rd) = @_; |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# Algorithm similar to the one on |
345
|
|
|
|
|
|
|
# http://home.capecod.net/~pbaum/date/injdalg2.htm |
346
|
|
|
|
|
|
|
# for the gregorian calendar |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
# Number of days since 1 Pedale 127 (day after first extra leap day) = |
349
|
|
|
|
|
|
|
# 24-02-2000 |
350
|
342
|
|
|
|
|
593
|
$rd -= 730173; |
351
|
|
|
|
|
|
|
|
352
|
342
|
|
|
|
|
939
|
my $a = _floor(($rd-0.25)/(100*365.2425)); |
353
|
342
|
|
|
|
|
949
|
my $b = $rd - 0.25 + $a - _floor($a/4); |
354
|
342
|
|
|
|
|
763
|
my $y = _floor($b/365.25); |
355
|
342
|
|
|
|
|
738
|
my $d = $rd + $a - _floor($a/4) - _floor(365.25*$y); |
356
|
|
|
|
|
|
|
|
357
|
342
|
|
|
|
|
607
|
my $m; |
358
|
342
|
100
|
|
|
|
977
|
if ($d < 5*28 + 1) { # Before 29 Gidouille |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
359
|
122
|
|
|
|
|
264
|
$m = _floor(($d-1)/28); |
360
|
122
|
|
|
|
|
241
|
$d -= $m * 28; |
361
|
|
|
|
|
|
|
} elsif ($d == 5*28 + 1) { # 29 Gidouille |
362
|
1
|
|
|
|
|
2
|
$m = 4; |
363
|
1
|
|
|
|
|
7
|
$d = 29; |
364
|
|
|
|
|
|
|
} elsif ($d < 366) { # Before 29 Gueules |
365
|
217
|
|
|
|
|
439
|
$m = _floor(($d-2)/28); |
366
|
217
|
|
|
|
|
463
|
$d -= $m*28 + 1; |
367
|
|
|
|
|
|
|
} else { # 29 Gueules (leap day) |
368
|
2
|
|
|
|
|
6
|
$m = 12; |
369
|
2
|
|
|
|
|
3
|
$d = 29; |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
342
|
|
|
|
|
551
|
$y += 127; |
373
|
342
|
|
|
|
|
510
|
$m += 7; |
374
|
342
|
100
|
|
|
|
896
|
if ($m > 13) { |
375
|
192
|
|
|
|
|
287
|
$m -= 13; |
376
|
192
|
|
|
|
|
314
|
$y ++; |
377
|
|
|
|
|
|
|
} |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
# There is no year 0 |
380
|
342
|
100
|
|
|
|
739
|
if ($y <= 0) { |
381
|
3
|
|
|
|
|
5
|
$y--; |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
|
384
|
342
|
|
|
|
|
878
|
return $y, $m, $d; |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
sub from_epoch { |
388
|
105
|
|
|
105
|
1
|
1847
|
my $class = shift; |
389
|
105
|
|
|
|
|
529
|
my %p = validate( @_, |
390
|
|
|
|
|
|
|
{ epoch => { type => SCALAR }, |
391
|
|
|
|
|
|
|
locale => { type => SCALAR | OBJECT, |
392
|
|
|
|
|
|
|
default => $class->DefaultLocale }, |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
); |
395
|
|
|
|
|
|
|
|
396
|
105
|
|
|
|
|
755
|
my $rd = int($p{epoch}/(24*60*60) + 719163); |
397
|
|
|
|
|
|
|
|
398
|
105
|
|
|
|
|
300
|
my ($y, $m, $d) = $class->_rd2ymd( $rd ); |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
return $class->new( year => $y, month => $m, day => $d, |
401
|
105
|
|
|
|
|
347
|
locale => $p{locale} ); |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
2
|
|
|
2
|
1
|
838
|
sub now { shift->from_epoch( epoch => (scalar time), @_ ) } |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
sub _add_overload { |
407
|
1
|
|
|
1
|
|
1321
|
my ($dt, $dur, $reversed) = @_; |
408
|
1
|
50
|
|
|
|
5
|
($dur, $dt) = ($dt, $dur) if $reversed; |
409
|
|
|
|
|
|
|
|
410
|
1
|
|
|
|
|
4
|
my $new = $dt->clone; |
411
|
1
|
|
|
|
|
4
|
$new->add_duration($dur); |
412
|
1
|
|
|
|
|
13
|
return $new; |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
sub _subtract_overload |
416
|
|
|
|
|
|
|
{ |
417
|
1
|
|
|
1
|
|
21
|
my ( $date1, $date2, $reversed ) = @_; |
418
|
1
|
50
|
|
|
|
6
|
($date1, $date2) = ($date2, $date1) if $reversed; |
419
|
|
|
|
|
|
|
|
420
|
1
|
50
|
|
|
|
9
|
if ( UNIVERSAL::isa($date2, 'DateTime::Duration') ) { |
421
|
0
|
|
|
|
|
0
|
my $new = $date1->clone; |
422
|
0
|
|
|
|
|
0
|
$new->add_duration( $date2->inverse ); |
423
|
0
|
|
|
|
|
0
|
return $new; |
424
|
|
|
|
|
|
|
} else { |
425
|
1
|
|
|
|
|
8
|
return $date1->subtract_datetime($date2); |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
5
|
|
|
5
|
1
|
32
|
sub add {return shift->add_duration(DateTime::Duration->new(@_)) } |
430
|
|
|
|
|
|
|
|
431
|
2
|
|
|
2
|
1
|
9
|
sub subtract { return shift->subtract_duration(DateTime::Duration->new(@_)) } |
432
|
|
|
|
|
|
|
|
433
|
2
|
|
|
2
|
1
|
242
|
sub subtract_duration { return $_[0]->add_duration( $_[1]->inverse ) } |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
sub add_duration { |
436
|
8
|
|
|
8
|
1
|
878
|
my ($self, $dur) = @_; |
437
|
|
|
|
|
|
|
|
438
|
8
|
|
|
|
|
24
|
my %deltas = $dur->deltas; |
439
|
|
|
|
|
|
|
|
440
|
8
|
50
|
|
|
|
132
|
$self->{year}++ if $self->{year} < 0; |
441
|
|
|
|
|
|
|
|
442
|
8
|
100
|
|
|
|
26
|
$self->{day} += $deltas{days} if $deltas{days}; |
443
|
8
|
100
|
|
|
|
20
|
$self->{month} += $deltas{months} if $deltas{months}; |
444
|
|
|
|
|
|
|
|
445
|
8
|
100
|
100
|
|
|
38
|
if ($self->{day} < 1 or $self->{day} > 29) { |
446
|
3
|
|
|
|
|
14
|
$self->{month} += _floor(($self->{day}-1)/29); |
447
|
3
|
|
|
|
|
8
|
$self->{day} %= 29; |
448
|
|
|
|
|
|
|
} |
449
|
8
|
100
|
100
|
|
|
36
|
if ($self->{month} < 1 or $self->{month} > 13) { |
450
|
3
|
|
|
|
|
12
|
$self->{year} += _floor(($self->{month}-1)/13); |
451
|
3
|
|
|
|
|
7
|
$self->{month} %= 13; |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
|
454
|
8
|
50
|
|
|
|
20
|
$self->{year}-- if $self->{year} <= 0; |
455
|
|
|
|
|
|
|
|
456
|
8
|
|
|
|
|
24
|
return $self; |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
sub subtract_datetime { |
460
|
1
|
|
|
1
|
1
|
6
|
my ($self, $dt) = @_; |
461
|
|
|
|
|
|
|
|
462
|
1
|
|
|
|
|
4
|
my ($syear, $dyear) = ($self->year, $dt->year); |
463
|
1
|
|
33
|
|
|
7
|
$_ < 0 and $_++ for $syear, $dyear; |
464
|
|
|
|
|
|
|
|
465
|
1
|
|
|
|
|
6
|
my $days_diff = ($syear - $dyear ) * 377 + |
466
|
|
|
|
|
|
|
($self->month - $dt->month) * 29 + |
467
|
|
|
|
|
|
|
($self->day - $dt->day ); |
468
|
1
|
|
|
|
|
6
|
return DateTime::Duration->new( days => $days_diff ); |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
|
471
|
11
|
|
|
11
|
|
45240
|
use constant INFINITY => 100 ** 100 ** 100 ; |
|
11
|
|
|
|
|
38
|
|
|
11
|
|
|
|
|
1281
|
|
472
|
11
|
|
|
11
|
|
153
|
use constant NEG_INFINITY => -1 * (100 ** 100 ** 100); |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
8038
|
|
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
sub _compare_overload |
475
|
|
|
|
|
|
|
{ |
476
|
|
|
|
|
|
|
# note: $_[1]->compare( $_[0] ) is an error when $_[1] is not a |
477
|
|
|
|
|
|
|
# DateTime (such as the INFINITY value) |
478
|
104
|
50
|
|
104
|
|
823
|
return $_[2] ? - $_[0]->compare( $_[1] ) : $_[0]->compare( $_[1] ); |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
sub compare |
482
|
|
|
|
|
|
|
{ |
483
|
104
|
50
|
|
104
|
1
|
335
|
my ($class, $dt1, $dt2) = ref $_[0] ? (undef, @_) : @_; |
484
|
|
|
|
|
|
|
|
485
|
104
|
50
|
|
|
|
251
|
return undef unless defined $dt2; |
486
|
|
|
|
|
|
|
|
487
|
104
|
50
|
33
|
|
|
283
|
return -1 if ! ref $dt2 && $dt2 == INFINITY; |
488
|
104
|
50
|
33
|
|
|
234
|
return 1 if ! ref $dt2 && $dt2 == NEG_INFINITY; |
489
|
|
|
|
|
|
|
|
490
|
104
|
50
|
|
|
|
398
|
$dt2 = $class->from_object( object => $dt2 ) |
491
|
|
|
|
|
|
|
unless $dt2->isa('DateTime::Calendar::Pataphysical'); |
492
|
|
|
|
|
|
|
|
493
|
104
|
|
100
|
|
|
242
|
return $dt1->year <=> $dt2->year || $dt1->month <=> $dt2->month || |
494
|
|
|
|
|
|
|
$dt1->day <=> $dt2->day; |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
my @feasts; |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
sub feast { |
501
|
5
|
|
|
5
|
1
|
32
|
return $feasts[ $_[0]->day_of_year_0 ][1]; |
502
|
|
|
|
|
|
|
} |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
sub type_of_feast { |
505
|
4
|
|
|
4
|
1
|
16
|
return $feasts[ $_[0]->day_of_year_0 ][0]; |
506
|
|
|
|
|
|
|
} |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
# Feasts from |
509
|
|
|
|
|
|
|
# http://perso.wanadoo.fr/mexiqueculture/nouvelles6-latumba.htm |
510
|
|
|
|
|
|
|
@feasts = map [/(.) (.+)/], split /\n+/, <<EOF; |
511
|
|
|
|
|
|
|
1 Nativité d'Alfred Jarry |
512
|
|
|
|
|
|
|
4 St Ptyx, silentiaire (Abolition de) |
513
|
|
|
|
|
|
|
4 St Phénix, solipsiste et St Hyx, factotum |
514
|
|
|
|
|
|
|
4 St Lucien de Samosate, voyageur |
515
|
|
|
|
|
|
|
4 St Bardamu, voyageur |
516
|
|
|
|
|
|
|
4 Ste Vérola, assistante sociale |
517
|
|
|
|
|
|
|
4 St Alambic, abstracteur |
518
|
|
|
|
|
|
|
3 Absinthe, ci-devant St Alfred |
519
|
|
|
|
|
|
|
4 Descente du St Esprit (de Vin) |
520
|
|
|
|
|
|
|
v Dilution |
521
|
|
|
|
|
|
|
4 Ste Purée, sportswoman |
522
|
|
|
|
|
|
|
v Vide |
523
|
|
|
|
|
|
|
4 St Canterel, l'illuminateur |
524
|
|
|
|
|
|
|
4 St Sophrotatos l'Arménien, pataphysicien |
525
|
|
|
|
|
|
|
3 Éthernité |
526
|
|
|
|
|
|
|
4 St Ibicrate le Géomètre, pataphysicien |
527
|
|
|
|
|
|
|
v Céphalorgie |
528
|
|
|
|
|
|
|
v Flûtes de Pan |
529
|
|
|
|
|
|
|
4 Stes Grues, ophiophiles |
530
|
|
|
|
|
|
|
4 Ste Mélusine, souillarde de cuisine |
531
|
|
|
|
|
|
|
4 St Venceslas, duc |
532
|
|
|
|
|
|
|
2 Emmanuel Dieu |
533
|
|
|
|
|
|
|
4 Ste Varia-Miriam, amphibie |
534
|
|
|
|
|
|
|
4 Sts Rakirs et Rastrons, porte-côtelettes |
535
|
|
|
|
|
|
|
4 Nativité de Sa Magnificence Opach |
536
|
|
|
|
|
|
|
4 St Joseb, notaire à la mode de Bretagne |
537
|
|
|
|
|
|
|
4 Stes Gigolette et Gaufrette, dogaresses |
538
|
|
|
|
|
|
|
v Xylostomie |
539
|
|
|
|
|
|
|
v Le Jet Musical |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
2 L'Âge du Dr Faustroll |
542
|
|
|
|
|
|
|
4 Dissolution d'E. Poe, dinomythurge |
543
|
|
|
|
|
|
|
4 St Gibus, franc-maçon |
544
|
|
|
|
|
|
|
4 Ste Berthe de Courrière, égérie |
545
|
|
|
|
|
|
|
4 Ste Belgique, nourrice |
546
|
|
|
|
|
|
|
4 Ste Tourte, lyrique et Ste Bévue, sociologue |
547
|
|
|
|
|
|
|
4 St Prout, abbé |
548
|
|
|
|
|
|
|
2 Fête du Haha |
549
|
|
|
|
|
|
|
v Tautologie |
550
|
|
|
|
|
|
|
4 St Panmuphle, huissier |
551
|
|
|
|
|
|
|
4 Sortie de St L. Cranach, apocalypticien |
552
|
|
|
|
|
|
|
4 St Cosinus, savant |
553
|
|
|
|
|
|
|
4 Bse Fenouillard, sainte famille |
554
|
|
|
|
|
|
|
4 Exhibition de la Daromphe |
555
|
|
|
|
|
|
|
3 Nativité de l'Œstre, artificier |
556
|
|
|
|
|
|
|
4 Ste Vadrouille, emblème |
557
|
|
|
|
|
|
|
4 St Homais d'Aquin, prudhomme |
558
|
|
|
|
|
|
|
4 Nativité de Sa Magnificence le baron Mollet (St Pipe) |
559
|
|
|
|
|
|
|
4 St Raphaël, apéritif et philistin |
560
|
|
|
|
|
|
|
3 Strangulation de Bosse-de-Nage |
561
|
|
|
|
|
|
|
3 Zimzoum de Bosse-de-Nage |
562
|
|
|
|
|
|
|
2 Résurrection de Bosse-de-Nage |
563
|
|
|
|
|
|
|
3 Chapeau de Bosse-de-Nage |
564
|
|
|
|
|
|
|
4 St Cl. Terrasse, musicien des Phynances |
565
|
|
|
|
|
|
|
4 St J.-P. Brisset, philologue, prince des penseurs |
566
|
|
|
|
|
|
|
4 Commémoration du Cure-dent |
567
|
|
|
|
|
|
|
1 Occultation d'Alfred Jarry |
568
|
|
|
|
|
|
|
4 Fuite d'Ablou |
569
|
|
|
|
|
|
|
v Marée Terrestre |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
3 Nativité de Pantagruel |
572
|
|
|
|
|
|
|
4 Ste Rrose Sélavy, héroïne |
573
|
|
|
|
|
|
|
4 Couronnement de Lord Patchogue, miroitier |
574
|
|
|
|
|
|
|
4 St Cravan, boxeur |
575
|
|
|
|
|
|
|
4 St Van Meegeren, faussaire |
576
|
|
|
|
|
|
|
4 St Omnibus, satyre |
577
|
|
|
|
|
|
|
4 St Cyrano de Bergerac, explorateur |
578
|
|
|
|
|
|
|
3 St Rimbe, oisif |
579
|
|
|
|
|
|
|
v Équarrissage pour tous |
580
|
|
|
|
|
|
|
4 St Abstrait, bourreau |
581
|
|
|
|
|
|
|
4 St Ossian, barde postiche |
582
|
|
|
|
|
|
|
3 Dispute du Signe + et du Signe - |
583
|
|
|
|
|
|
|
3 Moustaches du Dr Faustroll |
584
|
|
|
|
|
|
|
4 St P. Bonnard, peintre des Phynances |
585
|
|
|
|
|
|
|
1 Navigation du Dr Faustroll |
586
|
|
|
|
|
|
|
4 St Cap, captain |
587
|
|
|
|
|
|
|
4 St Pangloss, humoriste passif |
588
|
|
|
|
|
|
|
4 St Chambernac, pauvriseur |
589
|
|
|
|
|
|
|
4 St Courtial des Péreires, aérostier et inventeur |
590
|
|
|
|
|
|
|
4 St Olibrius, augure |
591
|
|
|
|
|
|
|
4 St Possible, schizophrène |
592
|
|
|
|
|
|
|
2 St Lautréamont |
593
|
|
|
|
|
|
|
4 St Quincey, critique d'art |
594
|
|
|
|
|
|
|
4 St Berbiguier, martyr |
595
|
|
|
|
|
|
|
4 St Lewis Carroll, professeur |
596
|
|
|
|
|
|
|
4 St Mensonger, évêque |
597
|
|
|
|
|
|
|
4 Ste Visité, fille du précédent |
598
|
|
|
|
|
|
|
4 Nativité de St Swift, chanoine |
599
|
|
|
|
|
|
|
v Traversée du Miroir |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
3 Noces de Balkis et de Salomon |
602
|
|
|
|
|
|
|
4 St Doublemain, idéologue |
603
|
|
|
|
|
|
|
4 St Phlegmon, doctrinaire |
604
|
|
|
|
|
|
|
4 Ste Barbe (femme à), femme-canon |
605
|
|
|
|
|
|
|
4 Ste Savate, avocate |
606
|
|
|
|
|
|
|
4 St Navet et Ste Perruque, humanistes |
607
|
|
|
|
|
|
|
4 St Birbe, juge |
608
|
|
|
|
|
|
|
2 Conception du P. Ubu (A. J.) |
609
|
|
|
|
|
|
|
4 St Sagouin, homme d'état |
610
|
|
|
|
|
|
|
1 Exaltation d'Ubu Roi (Ubu d'hiver) |
611
|
|
|
|
|
|
|
4 Nativité de St Grabbe, scherziste |
612
|
|
|
|
|
|
|
4 Ste Choupe, mère de famille |
613
|
|
|
|
|
|
|
4 St Flaive, concierge |
614
|
|
|
|
|
|
|
4 Don Quichotte, champion du monde |
615
|
|
|
|
|
|
|
2 Khurmookum du Dr Faustroll |
616
|
|
|
|
|
|
|
4 St Nul, exempt |
617
|
|
|
|
|
|
|
4 St Moyen, français |
618
|
|
|
|
|
|
|
4 Ste Lurette, joconde |
619
|
|
|
|
|
|
|
3 Gravidité de Mère Ubu |
620
|
|
|
|
|
|
|
4 St Sabre, allopathe |
621
|
|
|
|
|
|
|
4 Ste Tape, pompette |
622
|
|
|
|
|
|
|
1 César - Antechrist |
623
|
|
|
|
|
|
|
4 Ste Viole, vierge et martyre |
624
|
|
|
|
|
|
|
4 Ste Pochetée, gouvernante |
625
|
|
|
|
|
|
|
3 Nativité de l'Archéoptéryx |
626
|
|
|
|
|
|
|
4 Monsieur Sisyphe |
627
|
|
|
|
|
|
|
4 St Tic, conjoint |
628
|
|
|
|
|
|
|
4 St Cervelas, penseur |
629
|
|
|
|
|
|
|
v Aleph |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
3 St Alaodine, virtuose |
632
|
|
|
|
|
|
|
4 Sts Hassassins, praticiens |
633
|
|
|
|
|
|
|
4 Astu |
634
|
|
|
|
|
|
|
1 Décervelage |
635
|
|
|
|
|
|
|
4 Sts Giron, Pile et Cotice, palotins |
636
|
|
|
|
|
|
|
4 Sts Polonais, prolétaires |
637
|
|
|
|
|
|
|
4 Sts Forçats, poliorcètes |
638
|
|
|
|
|
|
|
3 St Bordure, capitaine |
639
|
|
|
|
|
|
|
4 Dormition de Jacques Vaché, interprète |
640
|
|
|
|
|
|
|
v Drapaud (érection du) |
641
|
|
|
|
|
|
|
4 St Eustache, libérateur |
642
|
|
|
|
|
|
|
4 St Landru, gynécologue |
643
|
|
|
|
|
|
|
4 St Guillotin, médecin |
644
|
|
|
|
|
|
|
4 Sts 4 Sans-Cou, enchanteurs |
645
|
|
|
|
|
|
|
3 Conscience d'Ubu |
646
|
|
|
|
|
|
|
4 St Mauvais, sujet |
647
|
|
|
|
|
|
|
4 St Mandrin, poète et philosophe |
648
|
|
|
|
|
|
|
4 Sts Pirates et Flibustiers, thaumaturges |
649
|
|
|
|
|
|
|
4 St et Ste Cartouche, vétérinaires |
650
|
|
|
|
|
|
|
4 St Outlaw, aristocrate |
651
|
|
|
|
|
|
|
1 Chaire du Dr Faustroll |
652
|
|
|
|
|
|
|
2 Ostention du Bâton à Physique |
653
|
|
|
|
|
|
|
4 St Tank, animal |
654
|
|
|
|
|
|
|
4 St Weidman, patriarche |
655
|
|
|
|
|
|
|
4 St Petiot, expert |
656
|
|
|
|
|
|
|
v Escrime |
657
|
|
|
|
|
|
|
4 Sts Chemins de fer, assassins |
658
|
|
|
|
|
|
|
v Repopulation |
659
|
|
|
|
|
|
|
v Lit de Procruste |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
3 Dépucelage de Mère Ubu |
662
|
|
|
|
|
|
|
4 St Sigisbée, eunuque |
663
|
|
|
|
|
|
|
4 St Anthropoïde, policier |
664
|
|
|
|
|
|
|
4 Ste Goule ou Gudule, institutrice |
665
|
|
|
|
|
|
|
4 Ste Gale, abbesse |
666
|
|
|
|
|
|
|
4 Ste Touche, postulante |
667
|
|
|
|
|
|
|
4 St Gueule, abbé |
668
|
|
|
|
|
|
|
3 Fête de la Chandelle Verte |
669
|
|
|
|
|
|
|
4 Ste Crêpe, laïque |
670
|
|
|
|
|
|
|
4 St Préservatif, bedeau |
671
|
|
|
|
|
|
|
4 St Baobab, célibataire |
672
|
|
|
|
|
|
|
4 St Membre, compilateur |
673
|
|
|
|
|
|
|
v Copulation |
674
|
|
|
|
|
|
|
4 Nativité de St J. Verne, globe-trotter en chambre |
675
|
|
|
|
|
|
|
3 Alice au Pays des Merveilles |
676
|
|
|
|
|
|
|
4 St Münchhausen, baron |
677
|
|
|
|
|
|
|
4 Le Bétrou, théurge |
678
|
|
|
|
|
|
|
4 Nativité de St Deibler, prestidigitateur |
679
|
|
|
|
|
|
|
4 St Sade ès liens |
680
|
|
|
|
|
|
|
4 St Lafleur, valet |
681
|
|
|
|
|
|
|
v Lavement |
682
|
|
|
|
|
|
|
2 St Sexe, stylite |
683
|
|
|
|
|
|
|
4 Occultation de St J. Torma, euphoriste |
684
|
|
|
|
|
|
|
4 Conversion de St Matorel, bateleur |
685
|
|
|
|
|
|
|
4 Ste Marmelade, inspirée |
686
|
|
|
|
|
|
|
3 L'Amour Absolu, deliquium |
687
|
|
|
|
|
|
|
4 Ste Tabagie, cosmogène |
688
|
|
|
|
|
|
|
4 Sts Hylactor et Pamphagus |
689
|
|
|
|
|
|
|
v Mouvement Perpétuel |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
3 Érection du Surmâle |
692
|
|
|
|
|
|
|
4 St André Marcueil, ascète cycliste |
693
|
|
|
|
|
|
|
4 St Ellen, hile |
694
|
|
|
|
|
|
|
4 St Michet, idéaliste |
695
|
|
|
|
|
|
|
4 St Ouducul, trouvère |
696
|
|
|
|
|
|
|
4 Vers Belges |
697
|
|
|
|
|
|
|
4 St Gavroche, forain |
698
|
|
|
|
|
|
|
3 La Machine à Inspirer l'Amour |
699
|
|
|
|
|
|
|
4 St Remezy, évêque in partibus |
700
|
|
|
|
|
|
|
4 Nativité de St Tancrède, jeune homme |
701
|
|
|
|
|
|
|
4 Testament de P. Uccello, le mal illuminé |
702
|
|
|
|
|
|
|
4 St Hari Seldon, psychohistorien galactique |
703
|
|
|
|
|
|
|
4 Ste Valburge, succube |
704
|
|
|
|
|
|
|
v Sabbat |
705
|
|
|
|
|
|
|
3 Sts Adelphes, ésotéristes |
706
|
|
|
|
|
|
|
4 Sts Templiers, adeptes |
707
|
|
|
|
|
|
|
4 St Dricarpe, prosélyte |
708
|
|
|
|
|
|
|
4 St Nosocome, carabin |
709
|
|
|
|
|
|
|
4 Ste Goutte, fête militaire |
710
|
|
|
|
|
|
|
4 Ste Cuisse, dame patronnesse |
711
|
|
|
|
|
|
|
4 St Inscrit, Converti |
712
|
|
|
|
|
|
|
2 St Sengle, déserteur |
713
|
|
|
|
|
|
|
4 St Masquarade, uniforme |
714
|
|
|
|
|
|
|
4 Nativité de St Stéphane, faune |
715
|
|
|
|
|
|
|
4 St Poligraf Poligrafovitch, chien |
716
|
|
|
|
|
|
|
4 St Pâle, mineur |
717
|
|
|
|
|
|
|
3 St Valens, frère onirique |
718
|
|
|
|
|
|
|
v Dédicace du Tripode |
719
|
|
|
|
|
|
|
4 Bse Escampette, dynamiteuse |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
3 St Ablou, page et St Haldern, duc |
722
|
|
|
|
|
|
|
4 Sts Hiboux, maîtres-chanteurs |
723
|
|
|
|
|
|
|
4 La Mandragore, solanée androïde |
724
|
|
|
|
|
|
|
4 St Pagne, confident |
725
|
|
|
|
|
|
|
4 Sts Aster et Vulpian, violateurs du Néant |
726
|
|
|
|
|
|
|
4 St Ganymède, professionnel |
727
|
|
|
|
|
|
|
v La Main de Gloire |
728
|
|
|
|
|
|
|
3 La Machine à Peindre |
729
|
|
|
|
|
|
|
4 Ste Trique, lunatique |
730
|
|
|
|
|
|
|
4 Rémission des Poissons |
731
|
|
|
|
|
|
|
4 St Maquereau, intercesseur |
732
|
|
|
|
|
|
|
4 St Georges Dazet, poulpe au regard de soie |
733
|
|
|
|
|
|
|
4 Nativité de Maldoror, corsaire aux cheveux d'or |
734
|
|
|
|
|
|
|
4 Sortie d'A. Dürer, hermétiste |
735
|
|
|
|
|
|
|
* Invention de la 'Pataphysique |
736
|
|
|
|
|
|
|
4 Exit St Domenico Theotocopouli, el Greco |
737
|
|
|
|
|
|
|
4 St Hiéronymus Bosch, démonarque |
738
|
|
|
|
|
|
|
v Les 27 Êtres Issus des Livres Pairs |
739
|
|
|
|
|
|
|
4 St Barbeau, procureur et Ste Morue, juste |
740
|
|
|
|
|
|
|
v Capture du Fourneau |
741
|
|
|
|
|
|
|
4 St Docteur Moreau, insulaire |
742
|
|
|
|
|
|
|
2 Fête des Polyèdres |
743
|
|
|
|
|
|
|
v Locus Solus |
744
|
|
|
|
|
|
|
4 St Tupetu de Tupetu, organisateur de loteries |
745
|
|
|
|
|
|
|
4 Exit St Goya, alchimiste |
746
|
|
|
|
|
|
|
4 St Escargot, sybarite |
747
|
|
|
|
|
|
|
4 Ste Hure de Chasteté, pénitente |
748
|
|
|
|
|
|
|
4 St Turgescent, iconoclaste |
749
|
|
|
|
|
|
|
v Cymbalum Mundi |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
3 Sts Crocodiles, crocodiles |
752
|
|
|
|
|
|
|
4 Fête des Écluses |
753
|
|
|
|
|
|
|
4 Sts Trolls, pantins |
754
|
|
|
|
|
|
|
4 Ste Susan Calvin, docteur |
755
|
|
|
|
|
|
|
4 Ste Poignée, veuve et Ste Jutte, recluse |
756
|
|
|
|
|
|
|
4 Ste Oneille, gourgandine |
757
|
|
|
|
|
|
|
4 St Fénéon ès Liens |
758
|
|
|
|
|
|
|
3 St Bougrelas, prince |
759
|
|
|
|
|
|
|
4 Sts Boleslas et Ladislas, polonais |
760
|
|
|
|
|
|
|
4 St Forficule, Barnabite |
761
|
|
|
|
|
|
|
v Explosion du Palotin |
762
|
|
|
|
|
|
|
v Réprobation du Travail |
763
|
|
|
|
|
|
|
4 Esquive de St Léonard (de Vinci), illusionniste |
764
|
|
|
|
|
|
|
4 St Équivoque, sans-culotte |
765
|
|
|
|
|
|
|
3 Adoration du Pal |
766
|
|
|
|
|
|
|
4 Déploration de St Achras, éleveur de Polyèdres |
767
|
|
|
|
|
|
|
4 St Macrotatoure, caudataire |
768
|
|
|
|
|
|
|
v Canotage |
769
|
|
|
|
|
|
|
4 Occultation de St Gauguin, océanide |
770
|
|
|
|
|
|
|
4 St Ti Belot, séide |
771
|
|
|
|
|
|
|
4 Occultation de Sa Magnificence le Dr Sandomir |
772
|
|
|
|
|
|
|
2 Sts Palotins des Phynances |
773
|
|
|
|
|
|
|
4 Sts Quatrezoneilles, Herdanpo, Mousched-Gogh, palotins |
774
|
|
|
|
|
|
|
4 Ste Lumelle, écuyère |
775
|
|
|
|
|
|
|
4 Sts Potassons, acolythes |
776
|
|
|
|
|
|
|
4 Ste Prétentaine, rosière |
777
|
|
|
|
|
|
|
4 St Foin, coryphée |
778
|
|
|
|
|
|
|
4 Nativité de St Satie, Grand Parcier de l'Église d'Art |
779
|
|
|
|
|
|
|
v Erratum |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
3 Accouchement de Ste Jeanne, papesse |
782
|
|
|
|
|
|
|
v Le Moutardier du Pape |
783
|
|
|
|
|
|
|
4 St Siège, sous-pape |
784
|
|
|
|
|
|
|
4 Nativité de St H. Rousseau, douanier |
785
|
|
|
|
|
|
|
4 St Crouducul, troupier |
786
|
|
|
|
|
|
|
4 St Cucufat, mécène |
787
|
|
|
|
|
|
|
4 Nativité de M. Plume, propriétaire |
788
|
|
|
|
|
|
|
2 Cocuage de M. le P. Ubu |
789
|
|
|
|
|
|
|
v Vidange |
790
|
|
|
|
|
|
|
4 St Barbapoux, amant |
791
|
|
|
|
|
|
|
4 St Memnon, vidangeur |
792
|
|
|
|
|
|
|
4 Stes Miches, catéchumènes |
793
|
|
|
|
|
|
|
4 Ste Lunette, solitaire |
794
|
|
|
|
|
|
|
4 St Sphincter, profès |
795
|
|
|
|
|
|
|
3 Sts Serpents d'Airain |
796
|
|
|
|
|
|
|
4 Nativité de St Donatien A. François |
797
|
|
|
|
|
|
|
4 St Woland, professeur |
798
|
|
|
|
|
|
|
4 St Anal, cordelier et Ste Foire, anagogue |
799
|
|
|
|
|
|
|
4 Ste Fétatoire, super |
800
|
|
|
|
|
|
|
4 Ste Colombine, expurgée |
801
|
|
|
|
|
|
|
4 Ste Pyrotechnie, illuminée |
802
|
|
|
|
|
|
|
* Ontogénie Pataphysique |
803
|
|
|
|
|
|
|
3 Interprétation de L'Umour |
804
|
|
|
|
|
|
|
4 Ste Purge, sage-femme |
805
|
|
|
|
|
|
|
2 Apparition D'Ubu Roi |
806
|
|
|
|
|
|
|
4 Ste Barbaque, naïade |
807
|
|
|
|
|
|
|
4 Sts Courts et Longs, gendarmes |
808
|
|
|
|
|
|
|
4 St Raca, cagot |
809
|
|
|
|
|
|
|
v Défaite du Mufle |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
3 Ste Bouzine, esprit |
812
|
|
|
|
|
|
|
4 St Lucullus, amateur (Bloomsday) |
813
|
|
|
|
|
|
|
4 Ste Dondon, amazone |
814
|
|
|
|
|
|
|
4 Ste Tripe, républicaine |
815
|
|
|
|
|
|
|
4 St Ugolin, mansuet |
816
|
|
|
|
|
|
|
4 St Dieu, retraité |
817
|
|
|
|
|
|
|
4 St Bébé Toutout, évangéliste |
818
|
|
|
|
|
|
|
3 Ste Boudouille, bayadère |
819
|
|
|
|
|
|
|
4 Ste Outre, psychiatre |
820
|
|
|
|
|
|
|
4 St Boudin, recteur |
821
|
|
|
|
|
|
|
4 Sacre de Talou VII, empereur du Ponukélé |
822
|
|
|
|
|
|
|
4 Ste Confiture, dévote et Ste Cliche, donatrice |
823
|
|
|
|
|
|
|
4 Sts Instintestins, conseillers intimes |
824
|
|
|
|
|
|
|
4 St Colon, artilleur |
825
|
|
|
|
|
|
|
3 Ste Giborgne, vénérable |
826
|
|
|
|
|
|
|
4 St Inventaire, poète |
827
|
|
|
|
|
|
|
4 Ste Femelle, technicienne |
828
|
|
|
|
|
|
|
2 Visitation de Mère Ubu |
829
|
|
|
|
|
|
|
4 St Sein, tautologue |
830
|
|
|
|
|
|
|
4 St Périnée, zélateur |
831
|
|
|
|
|
|
|
4 St Spéculum, confesseur |
832
|
|
|
|
|
|
|
2 Fête de Gidouille |
833
|
|
|
|
|
|
|
4 St Ombilic, gymnosophiste |
834
|
|
|
|
|
|
|
4 St Gris-gris, ventre |
835
|
|
|
|
|
|
|
4 St Bouffre, pontife |
836
|
|
|
|
|
|
|
4 Ste Goulache, odalisque |
837
|
|
|
|
|
|
|
4 Ste Gandouse, hygiéniste |
838
|
|
|
|
|
|
|
v Poche du Père Ubu |
839
|
|
|
|
|
|
|
2 Nom d'Ubu |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
1 Fête du P. Ubu (Ubu d'été) |
842
|
|
|
|
|
|
|
4 Commémoration du P. Ébé |
843
|
|
|
|
|
|
|
4 Ste Crapule, puriste et St Fantomas, archange |
844
|
|
|
|
|
|
|
4 Ascension du Mouchard, statisticien, psychiatre et policier |
845
|
|
|
|
|
|
|
4 St Arsouille, patricien |
846
|
|
|
|
|
|
|
4 Sts Robot et Cornard, citoyens |
847
|
|
|
|
|
|
|
4 St Biribi, taulier |
848
|
|
|
|
|
|
|
2 Susception du Croc à Merdre |
849
|
|
|
|
|
|
|
4 Sts Écrase-Merdre, sectateurs |
850
|
|
|
|
|
|
|
4 Sts Pieds Nickelés, trinité |
851
|
|
|
|
|
|
|
4 Stes Canicule et Canule, jouvencelles |
852
|
|
|
|
|
|
|
4 Sts Cannibales, philanthropes |
853
|
|
|
|
|
|
|
4 St Dada, prophète |
854
|
|
|
|
|
|
|
4 Ste Anne, pèlerine, énergumène |
855
|
|
|
|
|
|
|
2 Procession aux Phynances |
856
|
|
|
|
|
|
|
4 Transfiguration de St V. van Gogh, transmutateur |
857
|
|
|
|
|
|
|
4 Ste Flamberge, voyante |
858
|
|
|
|
|
|
|
4 St Trou, chauffeur |
859
|
|
|
|
|
|
|
4 Ste Taloche, matrone |
860
|
|
|
|
|
|
|
4 St Tiberge, frère quêteur |
861
|
|
|
|
|
|
|
4 Sts Catoblepas, lord et Anoblepas, amiral |
862
|
|
|
|
|
|
|
2 Ubu ès Liens |
863
|
|
|
|
|
|
|
4 St Pissembock, oncle |
864
|
|
|
|
|
|
|
4 St Pissedoux, caporal des hommes libres |
865
|
|
|
|
|
|
|
4 St Panurge, moraliste |
866
|
|
|
|
|
|
|
4 St Glé, neurologue-aliéniste |
867
|
|
|
|
|
|
|
4 St Pistolet à Merdre, jubilaire |
868
|
|
|
|
|
|
|
4 Nativité de St Bruggle |
869
|
|
|
|
|
|
|
v Le soleil solide froid |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
3 St Chibre, planton |
872
|
|
|
|
|
|
|
4 Ste Ruth, zélatrice |
873
|
|
|
|
|
|
|
4 St Zebb, passe-partout |
874
|
|
|
|
|
|
|
4 St Mnester, confesseur |
875
|
|
|
|
|
|
|
2 Assomption de Ste Messaline |
876
|
|
|
|
|
|
|
v Penis Angelicus |
877
|
|
|
|
|
|
|
4 St Patrobas, pompier |
878
|
|
|
|
|
|
|
3 Ste Léda, ajusteuse |
879
|
|
|
|
|
|
|
4 St Godemiché, économe |
880
|
|
|
|
|
|
|
4 Ste Nitouche, orante |
881
|
|
|
|
|
|
|
4 Ste Lèchefrite, botteuse |
882
|
|
|
|
|
|
|
4 Ste Andouille, amphibologue |
883
|
|
|
|
|
|
|
4 Ste Bitre, ouvreuse et St Étalon, couvreur |
884
|
|
|
|
|
|
|
3 Bataille de Morsang |
885
|
|
|
|
|
|
|
3 Mort de Dionysos, surhomme |
886
|
|
|
|
|
|
|
4 Nativité de St Vibescu, pohète et Commémoration de Ste Cuculine d'Ancône |
887
|
|
|
|
|
|
|
4 Ste Gallinacée, cocotte |
888
|
|
|
|
|
|
|
4 St Lingam, bouche-trou |
889
|
|
|
|
|
|
|
4 St Prélote, capucin |
890
|
|
|
|
|
|
|
4 St Pie VIII, navigant |
891
|
|
|
|
|
|
|
3 St Erbrand, polytechnicien |
892
|
|
|
|
|
|
|
2 Ste Dragonne, pyrophage |
893
|
|
|
|
|
|
|
4 St Lazare, gare |
894
|
|
|
|
|
|
|
4 Ste Orchidée, aumonière |
895
|
|
|
|
|
|
|
4 Nativité apparente d'Artaud le Momo |
896
|
|
|
|
|
|
|
4 Disparition de l'Ancien Breughel, incendiaire |
897
|
|
|
|
|
|
|
4 St Priape, franc-tireur |
898
|
|
|
|
|
|
|
3 Transfixion de Ste Messaline |
899
|
|
|
|
|
|
|
v Le Termès |
900
|
|
|
|
|
|
|
EOF |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
1; |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
__END__ |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
=for Pod::Coverage::TrustPod |
907
|
|
|
|
|
|
|
DefaultLocale |
908
|
|
|
|
|
|
|
day_0 |
909
|
|
|
|
|
|
|
day_of_month_0 |
910
|
|
|
|
|
|
|
day_of_week_0 |
911
|
|
|
|
|
|
|
day_of_year_0 |
912
|
|
|
|
|
|
|
locale |
913
|
|
|
|
|
|
|
mday_0 |
914
|
|
|
|
|
|
|
mon |
915
|
|
|
|
|
|
|
mon_0 |
916
|
|
|
|
|
|
|
month_0 |
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
=encoding utf-8 |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
=head1 NAME |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
DateTime::Calendar::Pataphysical - Dates in the Pataphysical calendar |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
=head1 VERSION |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
version 0.07 |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
=head1 SYNOPSIS |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
use DateTime::Calendar::Pataphysical; |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
$dt = DateTime::Calendar::Pataphysical->new( year => 1752, |
933
|
|
|
|
|
|
|
month => 10, |
934
|
|
|
|
|
|
|
day => 4 ); |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
=head1 DESCRIPTION |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
DateTime::Calendar::Pataphysical is the implementation of the |
939
|
|
|
|
|
|
|
Pataphysical calendar. Each year in this calendar contains 13 months of |
940
|
|
|
|
|
|
|
29 days. This regularity makes this a convenient alternative for the |
941
|
|
|
|
|
|
|
irregular Gregorian calendar. |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
This module is designed to be easy to use in combination with |
944
|
|
|
|
|
|
|
L<DateTime>. Most of its methods correspond to a L<DateTime> method of the |
945
|
|
|
|
|
|
|
same name. |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
=head1 CLASS METHODS |
948
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
=head2 new |
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
my $dt = DateTime::Calendar::Pataphysical-new( |
952
|
|
|
|
|
|
|
year => $year_in_the_pataphysical_era, |
953
|
|
|
|
|
|
|
month => $pataphysical_month_number, |
954
|
|
|
|
|
|
|
day => $pataphysical_day_number, |
955
|
|
|
|
|
|
|
); |
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
This class method accepts parameters for each date and time component: |
958
|
|
|
|
|
|
|
C<year>, C<month>, C<day>. Additionally, it accepts a C<locale> |
959
|
|
|
|
|
|
|
parameter. |
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
The C<rd_secs> parameter is also accepted. This parameter is only useful |
962
|
|
|
|
|
|
|
in conversions to other calendars; this calendar does not use its value. |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
=head2 from_epoch |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
my $dt = DateTime::Calendar::Pataphysical->from_epoch( epoch => $epoch, ... ); |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
This class method can be used to construct a new object from an epoch |
969
|
|
|
|
|
|
|
time instead of components. Just as with the L<new> constructor, it |
970
|
|
|
|
|
|
|
accepts a C<locale> parameter. |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
=head2 now |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
my $dt = DateTime::Calendar::Pataphysical->now; |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
This class method is equivalent to calling C<from_epoch()> with the |
977
|
|
|
|
|
|
|
value returned from Perl's L<time|perlfunc/time> function. |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
=head2 from_object |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
my $dt = DateTime::Calendar::Pataphysical->from_object( object => $object, ... ); |
982
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
This class method can be used to construct a new object from |
984
|
|
|
|
|
|
|
any object that implements the L<utc_rd_values> method. All |
985
|
|
|
|
|
|
|
L<DateTime::Calendar> modules must implement this method in order to |
986
|
|
|
|
|
|
|
provide cross-calendar compatibility. This method accepts a |
987
|
|
|
|
|
|
|
C<locale> parameter. |
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
The time part of C<$object> is stored, and will only be used if the created |
990
|
|
|
|
|
|
|
object is converted to another calendar. Only the date part of C<$object> |
991
|
|
|
|
|
|
|
is used to calculate the pataphysical date. This calculation is based on |
992
|
|
|
|
|
|
|
the local time and date of C<$object>. |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=head2 last_day_of_month |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
my $dt = DateTime::Calendar::Pataphysical->last_day_of_month( ... ); |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
This constructor takes the same arguments as can be given to the |
999
|
|
|
|
|
|
|
L<now> method, except for C<day>. Additionally, both C<year> and |
1000
|
|
|
|
|
|
|
C<month> are required. |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
=head1 METHODS |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
=head2 clone |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
my $clone = $dt->clone; |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
This object method returns a replica of the given object. |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=head2 year |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
Returns the year. |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
=head2 month |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
Returns the month of the year, from C<1 .. 13>. |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
=head2 month_name |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
Returns the name of the current month. |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
=head2 day_of_month |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
=head2 day |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=head2 mday |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
Returns the day of the month, from C<1 .. 29>. |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
=head2 day_of_week |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
=head2 wday |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
=head2 dow |
1035
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
Returns the day of the week as a number, from C<1 .. 7>, with C<1> being |
1037
|
|
|
|
|
|
|
Sunday and C<7> being Saturday. Returns C<undef> if the day is a "hunyadi". |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
=head2 day_name |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
Returns the name of the current day of the week. |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
=head2 day_of_year |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
=head2 doy |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
Returns the day of the year. |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
=head2 ymd |
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
=head2 mdy |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
=head2 dmy |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
my $string = $dt->ymd( $optional_separator ); |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
Each method returns the year, month, and day, in the order indicated |
1058
|
|
|
|
|
|
|
by the method name. Years are zero-padded to three digits. Months and |
1059
|
|
|
|
|
|
|
days are 0-padded to two digits. |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
By default, the values are separated by a dash (C<->), but this can be |
1062
|
|
|
|
|
|
|
overridden by passing a value to the method. |
1063
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
=head2 date |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
Alias for L<ymd>. |
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
=head2 datetime |
1069
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
Equivalent to |
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
$dt->ymd('-') . 'EP' |
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
=head2 is_leap_year |
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
This method returns a true or false indicating whether or not the |
1077
|
|
|
|
|
|
|
L<DateTime> object is in a leap year. |
1078
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
=head2 week |
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
my ( $week_year, $week_number ) = $dt->week; |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
Returns information about the calendar week which contains this |
1084
|
|
|
|
|
|
|
L<DateTime> object. The values returned by this method are also available |
1085
|
|
|
|
|
|
|
separately through the L<week_year> and L<week_number> methods. |
1086
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
=head2 week_year |
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
Returns the year of the week. In the Pataphysical calendar, this is |
1090
|
|
|
|
|
|
|
equal to the year of the date, as all weeks fall in one year only. |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
=head2 week_number |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
Returns the week of the year, from C<1 .. 53>. |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
The 29th of each month falls outside of any week; C<week_number> returns |
1097
|
|
|
|
|
|
|
C<undef> for these dates. |
1098
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
=head2 utc_rd_values |
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
Returns the current UTC Rata Die days and seconds as a two element |
1102
|
|
|
|
|
|
|
list. This exists primarily to allow other calendar modules to create |
1103
|
|
|
|
|
|
|
objects based on the values provided by this object. |
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
=head2 utc_rd_as_seconds |
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
Returns the current UTC Rata Die days and seconds purely as seconds. |
1108
|
|
|
|
|
|
|
This is useful when you need a single number to represent a date. |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
=head2 strftime |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
my $string = $dt->strftime( $format, ... ); |
1113
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
This method implements functionality similar to the C<strftime()> |
1115
|
|
|
|
|
|
|
method in C. However, if given multiple format strings, then it will |
1116
|
|
|
|
|
|
|
return multiple elements, one for each format string. |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
See L<DateTime> for a list of all possible format specifiers. This |
1119
|
|
|
|
|
|
|
module implements all specifiers related to dates. There is one |
1120
|
|
|
|
|
|
|
additional specifier: C<%*> represents the feast of that date. |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
=head2 feast |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
Returns the feast or vacuation of the given date. |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
=head2 type_of_feast |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
Returns the type of feast or vacuation. |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
'*' means Fête Suprème Première première |
1131
|
|
|
|
|
|
|
'1' means Fête Suprème Première seconde |
1132
|
|
|
|
|
|
|
'2' means Fête Suprème Seconde |
1133
|
|
|
|
|
|
|
'3' means Fête Suprème Tierce |
1134
|
|
|
|
|
|
|
'4' means Fête Suprème Quarte |
1135
|
|
|
|
|
|
|
'v' means Vacuation |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
=head2 is_imaginary |
1138
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
Returns true or false indicating whether the L<DateTime> object represents an |
1140
|
|
|
|
|
|
|
imaginary date. |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
=head2 set |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
This method can be used to change the local components of a date time, |
1145
|
|
|
|
|
|
|
or its locale. This method accepts any parameter allowed by L<new>. |
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
=head2 truncate |
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
$dt->truncate( to => ... ); |
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
This method allows you to reset some of the local time components in |
1152
|
|
|
|
|
|
|
the object to their C<zero> values. The C<to> parameter is used to |
1153
|
|
|
|
|
|
|
specify which values to truncate, and it may be one of C<year>, |
1154
|
|
|
|
|
|
|
C<month>, or C<day>. |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
=head2 add_duration |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
$dt->add_duration( $duration_object ); |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
This method adds a C<DateTime::Duration> to the current L<DateTime>. |
1161
|
|
|
|
|
|
|
See the L<DateTime::Duration> documentation for more details. |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
=head2 add |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
$dt->add( %arguments ); |
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
This method is syntactic sugar around the L<add_duration> method. It |
1168
|
|
|
|
|
|
|
simply creates a new L<DateTime::Duration> object using the parameters |
1169
|
|
|
|
|
|
|
given, and then calls the L<add_duration> method. |
1170
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
=head2 subtract_duration |
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
$dt->subtract_duration( $duration_object ); |
1174
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
When given a L<DateTime::Duration> object, this method simply calls |
1176
|
|
|
|
|
|
|
C<invert> on that object and passes that new duration to the |
1177
|
|
|
|
|
|
|
L<add_duration> method. |
1178
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
=head2 subtract |
1180
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
$dt->subtract( %arguments ); |
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
Like L<add>, this is syntactic sugar for the L<subtract_duration> method. |
1184
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
=head2 subtract_datetime |
1186
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
$dt->subtract_datetime( $datetime ); |
1188
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
This method returns a new L<DateTime::Duration> object representing |
1190
|
|
|
|
|
|
|
the difference between the two dates. |
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
=head2 compare |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
$cmp = DateTime->compare( $dt1, $dt2 ); |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
@dates = sort { DateTime->compare( $a, $b ) } @dates; |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
Compare two DateTime objects. The semantics are compatible with Perl's |
1199
|
|
|
|
|
|
|
L<sort|perlfunc/sort> function; it returns C<-1> if C<< $a < $b >>, C<0> |
1200
|
|
|
|
|
|
|
if C<$a == $b>, and C<1> if C<< $a > $b >>. |
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
Of course, since L<DateTime> objects overload comparison operators, you |
1203
|
|
|
|
|
|
|
can just do this anyway: |
1204
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
@dates = sort @dates; |
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
=head1 BUGS |
1208
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
=over 4 |
1210
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
=item * |
1212
|
|
|
|
|
|
|
|
1213
|
|
|
|
|
|
|
Adding a week to a date is exactly equivalent to adding seven days in |
1214
|
|
|
|
|
|
|
this module because of the way L<DateTime::Duration> is implemented. |
1215
|
|
|
|
|
|
|
The Hunyadis are not taken into account. |
1216
|
|
|
|
|
|
|
|
1217
|
|
|
|
|
|
|
=item * |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
L<from_epoch> and L<now> probably only work on Unix. |
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
=back |
1222
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
=head1 SUPPORT |
1224
|
|
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
Support for this module is provided via the datetime@perl.org email |
1226
|
|
|
|
|
|
|
list. See L<http://lists.perl.org/> for more details. |
1227
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
=head1 SEE ALSO |
1229
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
L<DateTime> |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
datetime@perl.org mailing list |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
=head1 AUTHOR |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
Eugene van der Pijll <pijll@gmx.net> |
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
Maintained by Philippe Bruhat (BooK) since 2014. |
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
=head1 COPYRIGHT |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
Copyright (c) 2003, 2004 Eugene van der Pijll. All rights reserved. |
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
=head1 LICENSE |
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
1247
|
|
|
|
|
|
|
under the same terms as Perl itself. |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
=cut |