line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::PM::Frankfurt::Meetings; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
95426
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
116
|
|
4
|
4
|
|
|
4
|
|
19
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
241
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
17
|
use Exporter; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
295
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
our @EXPORT = (); |
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw/next_meeting/; |
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
5467
|
use DateTime; |
|
4
|
|
|
|
|
716776
|
|
|
4
|
|
|
|
|
172
|
|
12
|
4
|
|
|
4
|
|
4493
|
use DateTime::Event::Recurrence; |
|
4
|
|
|
|
|
222448
|
|
|
4
|
|
|
|
|
182
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
################################################# |
15
|
|
|
|
|
|
|
## Every first Tuesday 7.30 pm (19:30 Uhr) |
16
|
|
|
|
|
|
|
################################################## |
17
|
4
|
|
|
4
|
|
52
|
use constant DAYS => 2; # Tuesday |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
259
|
|
18
|
4
|
|
|
4
|
|
21
|
use constant WEEKS => 1; # First Week |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
163
|
|
19
|
4
|
|
|
4
|
|
22
|
use constant HOURS => 19; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
157
|
|
20
|
4
|
|
|
4
|
|
20
|
use constant MINUTES => 30; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
181
|
|
21
|
4
|
|
|
4
|
|
70
|
use constant WEEK_START_DAY => '1tu'; # First Tuesday of the Month |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1287
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Acme::PM::Frankfurt::Meetings - Get the next date(s) of the Frankfurt PM meeting |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Version 0.20 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 UNMAINTENED MODULE |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This module is B and open to takeover. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
You may adopt it without prior confirmation. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use strict; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use warnings; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use Acme::PM::Frankfurt::Meetings qw/next_meeting/; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
print "Next Frankfurt.pm meeting: ", next_meeting(1) , "\n"; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
print "Next 3 Frankfurt.pm meetings:\n"; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
print join("\n", next_meeting(3) ), "\n"; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# $dt is a DateTime Object |
59
|
|
|
|
|
|
|
my $dt = next_meeting; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $ymd = $dt->ymd('/'); |
62
|
|
|
|
|
|
|
print "$ymd\n"; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $hms = $dt->hms; |
65
|
|
|
|
|
|
|
print "$hms\n"; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SUBROUTINES |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Nothing is imported/exported by default. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 next_meeting |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Computes the date(s) of the next meetings. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Accepts a count for the number of dates returned (defaults to 1 - next meeting). |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Dies on non positive integer counts. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns an array of DateTime objects in list context and a single object in scalar context. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
use Acme::PM::Frankfurt::Meetings qw/next_meeting/; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Next meeting |
87
|
|
|
|
|
|
|
# List Context |
88
|
|
|
|
|
|
|
print "Next Frankfurt.pm meeting: ", next_meeting, "\n"; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Next three meetings |
91
|
|
|
|
|
|
|
my @dates = next_meeting(3); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
foreach my $date ( @dates ) { |
94
|
|
|
|
|
|
|
print "Frankfurt.pm meeting: $date\n"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# $dt is a DateTime Object |
98
|
|
|
|
|
|
|
my $dt = next_meeting; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $ymd = $dt->ymd('/'); |
101
|
|
|
|
|
|
|
print "$ymd\n"; |
102
|
|
|
|
|
|
|
my $hms = $dt->hms; |
103
|
|
|
|
|
|
|
print "$hms\n"; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub next_meeting { |
108
|
4
|
|
|
4
|
1
|
1563
|
my $count = shift; |
109
|
4
|
100
|
|
|
|
19
|
$count = 1 unless defined $count; |
110
|
4
|
50
|
|
|
|
34
|
die "Gimme a number" unless $count =~ m/^\d+$/; |
111
|
4
|
50
|
|
|
|
19
|
die "Gimme a positive integer" if $count < 1; |
112
|
4
|
|
|
|
|
40
|
my $dt = DateTime->now( time_zone => 'Europe/Berlin' ); |
113
|
4
|
|
|
|
|
37386
|
my @dates = map { $dt = _next_meeting_dt($dt) } ( 1 .. $count ); |
|
29
|
|
|
|
|
726924
|
|
114
|
4
|
100
|
|
|
|
111333
|
return wantarray ? @dates : $dates[0]; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 _next_meeting_dt |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Internal only - computes the next set |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _next_meeting_dt { |
124
|
29
|
|
|
29
|
|
63
|
my $dt = shift; |
125
|
29
|
|
|
|
|
222
|
my $monthly_set = DateTime::Event::Recurrence->monthly( |
126
|
|
|
|
|
|
|
days => DAYS, |
127
|
|
|
|
|
|
|
weeks => WEEKS, |
128
|
|
|
|
|
|
|
hours => HOURS, |
129
|
|
|
|
|
|
|
minutes => MINUTES, |
130
|
|
|
|
|
|
|
week_start_day => WEEK_START_DAY, |
131
|
|
|
|
|
|
|
); |
132
|
29
|
|
|
|
|
25645
|
my $dt_next = $monthly_set->next($dt); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 PREREQUISITES |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * DateTime L |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * DateTime::Event::Recurrence L |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Thomas Fahle, C<< >> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 BUGS |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
153
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
154
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 SUPPORT |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
perldoc Acme::PM::Frankfurt::Meetings |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
You can also look for information at: |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * CPAN Ratings |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * Search CPAN |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=back |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Heavily inspired by Acme::PM::Berlin::Meetings L |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 SEE ALSO |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=over 4 |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * Frankfurt.pm L |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=back |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
204
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
205
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
1; # End of Acme::PM::Frankfurt::Meetings |