line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DateTime::TimeZone::ICal::Spec; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
38
|
use 5.010; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
60
|
|
5
|
2
|
|
|
2
|
|
6
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
88
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
8
|
2
|
|
|
2
|
|
483
|
use namespace::autoclean; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'DateTime::TimeZone::ICal::Parsing'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
DateTime::TimeZone::ICal::Spec - Class for holding Standard/DST specs |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Version 0.01 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# assume $vtimezone is a Data::ICal::Entry::TimeZone |
27
|
|
|
|
|
|
|
my @spec = @{$vtimezone->entries} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
@spec = map { DateTime::TimeZone::ICal::Spec->from_ical_entry } @spec; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 new %PARAMS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over 4 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item dtstart |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has dtstart => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
required => 1, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item tzoffsetto |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has tzoffsetto => ( |
51
|
|
|
|
|
|
|
is => 'ro', |
52
|
|
|
|
|
|
|
required => 1, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item tzoffsetfrom |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has tzoffsetfrom => ( |
60
|
|
|
|
|
|
|
is => 'ro', |
61
|
|
|
|
|
|
|
required => 1, |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item rrule |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
has _rrule => ( |
69
|
|
|
|
|
|
|
is => 'ro', |
70
|
|
|
|
|
|
|
default => sub { [] }, |
71
|
|
|
|
|
|
|
init_arg => 'rrule', |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item rdate |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
has _rdate => ( |
79
|
|
|
|
|
|
|
is => 'ro', |
80
|
|
|
|
|
|
|
default => sub { [] }, |
81
|
|
|
|
|
|
|
init_arg => 'rdate', |
82
|
|
|
|
|
|
|
# isa => 'ArrayRef[DateTime]', |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item tzname |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
has tzname => ( |
90
|
|
|
|
|
|
|
is => 'ro', |
91
|
|
|
|
|
|
|
default => sub { [] }, |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item comment |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
has comment => ( |
99
|
|
|
|
|
|
|
is => 'ro', |
100
|
|
|
|
|
|
|
default => sub { [] }, |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub BUILD { |
108
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# fix the offset of dtstart |
111
|
0
|
|
|
|
|
|
my $start = $self->dtstart; |
112
|
0
|
|
|
|
|
|
$start->set_time_zone($self->tzoffsetto); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# now fix the recurrence rules |
115
|
0
|
|
|
|
|
|
my $set; |
116
|
0
|
|
|
|
|
|
for my $rule (@{$self->_rrule}) { |
|
0
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
|
my $x = eval { DateTime::Format::ICal->parse_recurrence |
|
0
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
(recurrence => $rule, dtstart => $start) } or next; |
119
|
0
|
0
|
|
|
|
|
$set = $set ? $set->union($x) : $x; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# XXX don't do rdate for now |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$self->recurrence($set); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 recurrence |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
has recurrence => ( |
132
|
|
|
|
|
|
|
is => 'rw', |
133
|
|
|
|
|
|
|
); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 from_ical_entry $ENTRY |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub from_ical_entry { |
141
|
0
|
|
|
0
|
1
|
|
my ($class, $entry) = @_; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# make sure this is legit |
145
|
0
|
0
|
0
|
|
|
|
return unless $entry->can('ical_entry_type') |
146
|
|
|
|
|
|
|
and $entry->ical_entry_type =~ /^(?:STANDARD|DAYLIGHT)$/; |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
my %out; |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
for my $name ($entry->mandatory_unique_properties, |
151
|
|
|
|
|
|
|
$entry->optional_unique_properties) { |
152
|
0
|
0
|
|
|
|
|
my ($prop) = @{$entry->property($name) || []}; |
|
0
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
$prop = $class->parse_val($prop); |
154
|
0
|
|
|
|
|
|
$out{$name} = $prop; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
for my $name ($entry->mandatory_repeatable_properties, |
158
|
|
|
|
|
|
|
$entry->optional_repeatable_properties) { |
159
|
0
|
0
|
|
|
|
|
my @prop = @{$entry->property($name) || []}; |
|
0
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
@prop = map { $class->parse_val($_) } @prop; |
|
0
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
$out{$name} = \@prop; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# this is a class method |
165
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class; |
166
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
return $class->new(%out); |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Dorian Taylor, C<< >> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 BUGS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
177
|
|
|
|
|
|
|
C, or through the web |
178
|
|
|
|
|
|
|
interface at |
179
|
|
|
|
|
|
|
L. |
180
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of |
181
|
|
|
|
|
|
|
progress on your bug as I make changes. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 SUPPORT |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
perldoc DateTime::TimeZone::ICal::Spec |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
You can also look for information at: |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=over 4 |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
L |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
L |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * CPAN Ratings |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
L |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item * Search CPAN |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
L |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=back |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Copyright 2015 Dorian Taylor. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); you |
217
|
|
|
|
|
|
|
may not use this file except in compliance with the License. You may |
218
|
|
|
|
|
|
|
obtain a copy of the License at |
219
|
|
|
|
|
|
|
L. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software |
222
|
|
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS, |
223
|
|
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
224
|
|
|
|
|
|
|
implied. See the License for the specific language governing |
225
|
|
|
|
|
|
|
permissions and limitations under the License. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
1; # End of DateTime::TimeZone::ICal::Spec |