| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Wikevent::Event; |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Copyright 2007 Mark Jaroski |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
6
|
|
|
|
|
|
|
# it under the terms of either: |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# a) the GNU General Public License as published by the Free Software |
|
9
|
|
|
|
|
|
|
# Foundation; either version 3, or (at your option) any later version, |
|
10
|
|
|
|
|
|
|
# or |
|
11
|
|
|
|
|
|
|
# b) the "Artistic License" which comes with this Kit. |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, but |
|
14
|
|
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the |
|
16
|
|
|
|
|
|
|
# GNU General Public License or the Artistic License for more details. |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
# You should have received a copy of the Artistic License with this Kit, |
|
19
|
|
|
|
|
|
|
# in the file named "Artistic". |
|
20
|
|
|
|
|
|
|
# |
|
21
|
|
|
|
|
|
|
# You should also have received a copy of the GNU General Public License |
|
22
|
|
|
|
|
|
|
# along with this program in the file named "Copying". If not, write to |
|
23
|
|
|
|
|
|
|
# the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
|
24
|
|
|
|
|
|
|
# Boston, MA 02111-1307, USA or visit their web page on the internet at |
|
25
|
|
|
|
|
|
|
# http://www.gnu.org/copyleft/gpl.html. |
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
44275
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
41
|
|
|
28
|
1
|
|
|
1
|
|
2040
|
use overload q{""} => 'to_string'; |
|
|
1
|
|
|
|
|
1210
|
|
|
|
1
|
|
|
|
|
11
|
|
|
29
|
1
|
|
|
1
|
|
1149
|
use Date::Parse; |
|
|
1
|
|
|
|
|
9790
|
|
|
|
1
|
|
|
|
|
143
|
|
|
30
|
1
|
|
|
1
|
|
1034
|
use Date::Format; |
|
|
1
|
|
|
|
|
3579
|
|
|
|
1
|
|
|
|
|
70
|
|
|
31
|
1
|
|
|
1
|
|
2917
|
use Encode; |
|
|
1
|
|
|
|
|
23235
|
|
|
|
1
|
|
|
|
|
95
|
|
|
32
|
1
|
|
|
1
|
|
10
|
use utf8; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
WWW::Wikevent::Event |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use WWW::Wikevent::Event; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $event = WWW::Wikevent::Event->new(); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
but more usually you will get an event object from a Wikevent bot: |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $bot = WWW::Wikevent::Bot->new(); |
|
49
|
|
|
|
|
|
|
my $event = $bot->add_event(); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Then use accessor methods to set event data: |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$event->name( 'Hideout Block Party' ); |
|
54
|
|
|
|
|
|
|
$event->price( '$10' ); |
|
55
|
|
|
|
|
|
|
$event->date( '2007-09-09' ); |
|
56
|
|
|
|
|
|
|
$event->locality( 'Chicago' ); |
|
57
|
|
|
|
|
|
|
$event->venue( 'The Hideout' ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
etcetera. Then: |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
print $event; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
which will print the event out as wikitext. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
WWW::Wikevent::Event is a package which will help you write scraper scripts |
|
70
|
|
|
|
|
|
|
for gathering events from venue and artist websites and for inclusion in |
|
71
|
|
|
|
|
|
|
the Free content events compendium, Wikevent. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The module takes care of building up an event tag for Wikevent, so you can |
|
74
|
|
|
|
|
|
|
get busy with the fun work of scraping a venue's web pages for the |
|
75
|
|
|
|
|
|
|
data. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 CONSTANTS |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item $REQ_WARNING; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The warning given if you print an event which is missing required |
|
86
|
|
|
|
|
|
|
attributes. In fact there really aren't any truly required attributes, but |
|
87
|
|
|
|
|
|
|
these are needed to correctly place an event on the Wikevent site. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $REQ_WARNING = "The following attributes are missing:\n"; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 CONSTRUCTORS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 new |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $event = WWW::Wikevent::Event->new(); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Creates and returns a new event object. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub new { |
|
108
|
1
|
|
|
1
|
1
|
11
|
my $pkg = shift; |
|
109
|
1
|
|
|
|
|
6
|
my $self = bless {}, $pkg; |
|
110
|
1
|
|
|
|
|
46
|
$self->{'who'} = []; |
|
111
|
1
|
|
|
|
|
4
|
$self->{'what'} = []; |
|
112
|
1
|
|
|
|
|
8
|
return $self; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 name |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$event->name( $name ); |
|
122
|
|
|
|
|
|
|
my $name = $event->name(); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The name of the event. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub name { |
|
129
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $name ) = @_; |
|
130
|
2
|
100
|
|
|
|
6
|
if ( $name ) { |
|
131
|
1
|
|
|
|
|
3
|
$self->{'name'} = $name; |
|
132
|
1
|
|
|
|
|
15
|
$self->{'name'} =~ s{(\w+)}{\u\L$1}g; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
2
|
|
|
|
|
13
|
return $self->{'name'}; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 date |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$event->date( $date_string ); |
|
140
|
|
|
|
|
|
|
my $date_string = $event->date(); |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The date of the event. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
While Wikevent will accept and try to work with a number of date formats, |
|
145
|
|
|
|
|
|
|
in practice the very best results will be achieved by using the a format |
|
146
|
|
|
|
|
|
|
like '2007-09-20'. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub date { |
|
151
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $date ) = @_; |
|
152
|
2
|
100
|
|
|
|
9
|
$self->{'date'} = $date if $date; |
|
153
|
2
|
|
|
|
|
10
|
return $self->{'date'}; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 time |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
$event->time( $time_string ); |
|
159
|
|
|
|
|
|
|
my $time_string = $event->time(); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
The start time of the event. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Wikevent accepts a fairly wide range of formats for the time fields. You |
|
164
|
|
|
|
|
|
|
can use am/pm times like this: "9pm", "9:15pm", or if you prefer 24 hour |
|
165
|
|
|
|
|
|
|
times like this: "15:30" or even the French style "15h30". |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub time { |
|
170
|
2
|
|
|
2
|
1
|
3
|
my ( $self, $time ) = @_; |
|
171
|
2
|
100
|
|
|
|
7
|
$self->{'time'} = $time if $time; |
|
172
|
2
|
|
|
|
|
8
|
return $self->{'time'}; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 endtime |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
$event->endtime( $time_string ); |
|
178
|
|
|
|
|
|
|
my $time_string = $event->endtime(); |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
The time at which your event ends. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
See C |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub endtime { |
|
187
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $endtime ) = @_; |
|
188
|
2
|
100
|
|
|
|
7
|
$self->{'endtime'} = $endtime if $endtime; |
|
189
|
2
|
|
|
|
|
7
|
return $self->{'endtime'}; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 duration |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
$event->duration( $duration_string ); |
|
195
|
|
|
|
|
|
|
my $duration_string = $event->duration(); |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
The duration of the event. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
An alternative to setting the endtime, this field accepts pretty much the same |
|
200
|
|
|
|
|
|
|
format as the time fields. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub duration { |
|
205
|
4
|
|
|
4
|
1
|
8
|
my ( $self, $duration ) = @_; |
|
206
|
4
|
100
|
|
|
|
13
|
$self->{'duration'} = $duration if $duration; |
|
207
|
4
|
|
|
|
|
16
|
return $self->{'duration'}; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 price |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
$event->price( $price_string ); |
|
213
|
|
|
|
|
|
|
my $price_string = $event->price(); |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
The price of attending, and some short info. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
This is a free text string, but should be used sparingly to report ticket |
|
218
|
|
|
|
|
|
|
and door prices. |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub price { |
|
223
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $price ) = @_; |
|
224
|
2
|
100
|
|
|
|
13
|
$self->{'price'} = $price if $price; |
|
225
|
2
|
|
|
|
|
7
|
return $self->{'price'}; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 tickets |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
$event->tickets( $tickets_url ); |
|
231
|
|
|
|
|
|
|
my $tickets_url = $event->tickets(); |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
A URL which points to the venue's e-commerce page, if there is one. |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
This field must be a URL or it won't work. Please pay attention to any |
|
236
|
|
|
|
|
|
|
rules that the venue site might have about "deep" linking, and do make sure |
|
237
|
|
|
|
|
|
|
that you only link to the venue site, or it's designated agent, NEVER to |
|
238
|
|
|
|
|
|
|
some 3rd party. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub tickets { |
|
243
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $tickets ) = @_; |
|
244
|
2
|
100
|
|
|
|
8
|
$self->{'tickets'} = $tickets if $tickets; |
|
245
|
2
|
|
|
|
|
8
|
return $self->{'tickets'}; |
|
246
|
|
|
|
|
|
|
} |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head2 restrictions |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
$event->restrictions( $restrictions ); |
|
251
|
|
|
|
|
|
|
my $restrictions = $event->restrictions(); |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Any restrictions placed on attendance. |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
In many jursidtictions there are limits on who can attend events at which |
|
256
|
|
|
|
|
|
|
alcohol is being sold, for instance. This field is for recording those |
|
257
|
|
|
|
|
|
|
rules, examples might be "21 and over", or "18 and over", or "All Ages". |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=cut |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub restrictions { |
|
262
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $restrictions ) = @_; |
|
263
|
2
|
100
|
|
|
|
9
|
$self->{'restrictions'} = $restrictions if $restrictions; |
|
264
|
2
|
|
|
|
|
7
|
return $self->{'restrictions'}; |
|
265
|
|
|
|
|
|
|
} |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 lang |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
$event->lang( $language_code ); |
|
270
|
|
|
|
|
|
|
my $language_code = $event->lang(); |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
A comma seperated list of two letter language codes for languages which |
|
273
|
|
|
|
|
|
|
will be used on stage at the event. |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=cut |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
sub lang { |
|
278
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $lang ) = @_; |
|
279
|
2
|
100
|
|
|
|
10
|
$self->{'lang'} = $lang if $lang; |
|
280
|
2
|
|
|
|
|
9
|
return $self->{'lang'}; |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head2 locality |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
$event->locality( $locality ); |
|
286
|
|
|
|
|
|
|
my $locality = $event->locality(); |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
The city, town, or village in which the event is taking place. |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=cut |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
sub locality { |
|
293
|
2
|
|
|
2
|
1
|
6
|
my ( $self, $locality ) = @_; |
|
294
|
2
|
100
|
|
|
|
72
|
$self->{'locality'} = $locality if $locality; |
|
295
|
2
|
|
|
|
|
8
|
return $self->{'locality'}; |
|
296
|
|
|
|
|
|
|
} |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head2 venue |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
$event->venue( $venue ); |
|
301
|
|
|
|
|
|
|
my $venue = $event->venue(); |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
The club, hall, auditorium, or street where the event is taking place. |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub venue { |
|
308
|
2
|
|
|
2
|
1
|
3
|
my ( $self, $venue ) = @_; |
|
309
|
2
|
100
|
|
|
|
9
|
$self->{'venue'} = $venue if $venue; |
|
310
|
2
|
|
|
|
|
7
|
return $self->{'venue'}; |
|
311
|
|
|
|
|
|
|
} |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=head2 desc |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
$event->desc( $wikitext ); |
|
316
|
|
|
|
|
|
|
my $wikitext = $event->desc(); |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
A discription of the event in Mediawiki wikitext. |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
For a complete description of the Wikitext markup language please see the |
|
321
|
|
|
|
|
|
|
L. |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub desc { |
|
326
|
24
|
|
|
24
|
1
|
75
|
my ( $self, $desc ) = @_; |
|
327
|
24
|
100
|
|
|
|
47
|
$self->{'desc'} = $desc if $desc; |
|
328
|
24
|
|
|
|
|
53
|
return $self->{'desc'}; |
|
329
|
|
|
|
|
|
|
} |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=head2 who |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
$event->who( @who ); |
|
334
|
|
|
|
|
|
|
$event->who( $who_ref ); |
|
335
|
|
|
|
|
|
|
my @who = $event->who(); |
|
336
|
|
|
|
|
|
|
my $who_ref = $event->who(); |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
An array, or array reference, of names of artists, etc. appearing at the |
|
339
|
|
|
|
|
|
|
event. |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
It's best to use this field and its related methods only if you can't |
|
342
|
|
|
|
|
|
|
include the appropriate markup in the description wikitext itself. Don't |
|
343
|
|
|
|
|
|
|
do both, since this list will be printed out as a wikitext unordered list |
|
344
|
|
|
|
|
|
|
at the top of the event description. |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=cut |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
sub who { |
|
349
|
29
|
|
|
29
|
1
|
41
|
my $self = shift; |
|
350
|
29
|
100
|
100
|
|
|
115
|
if ( @_ && ref $_[0] eq 'ARRAY' ) { |
|
|
|
100
|
|
|
|
|
|
|
351
|
1
|
|
|
|
|
3
|
$self->{'who'} = shift; |
|
352
|
|
|
|
|
|
|
} elsif ( @_ ) { |
|
353
|
1
|
|
|
|
|
35
|
$self->{'who'} = \@_; |
|
354
|
|
|
|
|
|
|
} |
|
355
|
29
|
100
|
|
|
|
65
|
return wantarray ? @{$self->{'who'}} : $self->{'who'}; |
|
|
24
|
|
|
|
|
114
|
|
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=head2 what |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
$event->what( @what ); |
|
361
|
|
|
|
|
|
|
$event->what( $what_ref ); |
|
362
|
|
|
|
|
|
|
my @what = $event->what(); |
|
363
|
|
|
|
|
|
|
my $what_ref = $event->what(); |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
An array, or array reference, of names of cateogories to which this event |
|
366
|
|
|
|
|
|
|
belongs. |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=cut |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub what { |
|
371
|
29
|
|
|
29
|
1
|
847
|
my $self = shift; |
|
372
|
29
|
100
|
100
|
|
|
113
|
if ( @_ && ref $_[0] eq 'ARRAY' ) { |
|
|
|
100
|
|
|
|
|
|
|
373
|
1
|
|
|
|
|
4
|
$self->{'what'} = shift; |
|
374
|
|
|
|
|
|
|
} elsif ( @_ ) { |
|
375
|
1
|
|
|
|
|
4
|
$self->{'what'} = \@_; |
|
376
|
|
|
|
|
|
|
} |
|
377
|
29
|
100
|
|
|
|
63
|
return wantarray ? @{$self->{'what'}} : $self->{'what'}; |
|
|
24
|
|
|
|
|
73
|
|
|
378
|
|
|
|
|
|
|
} |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
=head1 METHODS |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=cut |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=head2 add_who |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
$event->add_who( $name ); |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
Add a single artist, organizer, etc. to the C list. |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=cut |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
sub add_who { |
|
393
|
1
|
|
|
1
|
1
|
661
|
my ( $self, $who ) = @_; |
|
394
|
1
|
|
|
|
|
2
|
push @{$self->{'who'}}, $who; |
|
|
1
|
|
|
|
|
3
|
|
|
395
|
1
|
|
|
|
|
4
|
return $self->who(); |
|
396
|
|
|
|
|
|
|
} |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
=head2 add_what |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
$event->add_what( $category ); |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
Add a single category to the C list. |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=cut |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
sub add_what { |
|
408
|
1
|
|
|
1
|
1
|
39
|
my ( $self, $what ) = @_; |
|
409
|
1
|
|
|
|
|
4
|
push @{$self->{'what'}}, $what; |
|
|
1
|
|
|
|
|
5
|
|
|
410
|
1
|
|
|
|
|
3
|
return $self->what(); |
|
411
|
|
|
|
|
|
|
} |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=head2 who_string |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
$who_tags = $this->who_string(); |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
Renders the C list as a as tags for inclusion in the event |
|
418
|
|
|
|
|
|
|
description. |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=cut |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub who_string { |
|
423
|
23
|
|
|
23
|
1
|
30
|
my $self = shift; |
|
424
|
23
|
|
|
|
|
28
|
my $string = ''; |
|
425
|
23
|
|
|
|
|
45
|
foreach my $who ( $self->who() ) { |
|
426
|
16
|
|
|
|
|
39
|
$string .= "* $who\n"; |
|
427
|
|
|
|
|
|
|
} |
|
428
|
23
|
100
|
|
|
|
68
|
return $string eq '' ? undef : $string; |
|
429
|
|
|
|
|
|
|
} |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=head2 what_string |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
$what_tags = $this->what_string(); |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
Renders the C list as a as tags for inclusion in the event |
|
436
|
|
|
|
|
|
|
description. |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=cut |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
sub what_string { |
|
442
|
23
|
|
|
23
|
1
|
33
|
my $self = shift; |
|
443
|
23
|
|
|
|
|
24
|
my @ret; |
|
444
|
23
|
|
|
|
|
46
|
foreach my $what ( $self->what() ) { |
|
445
|
11
|
|
|
|
|
29
|
push @ret, "$what"; |
|
446
|
|
|
|
|
|
|
} |
|
447
|
23
|
50
|
|
|
|
71
|
if ( length( @ret ) > 0 ) { |
|
448
|
23
|
|
|
|
|
67
|
return join( ', ', @ret ); |
|
449
|
|
|
|
|
|
|
} else { |
|
450
|
0
|
|
|
|
|
0
|
return undef; |
|
451
|
|
|
|
|
|
|
} |
|
452
|
|
|
|
|
|
|
} |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=head2 to_string |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
my $event_tag = $event->to_string(); |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
Renders the event as an Event tag for inclusion on Wikevent. |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=cut |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
sub to_string { |
|
463
|
22
|
|
|
22
|
1
|
80
|
my ( $e, $bot) = @_; |
|
464
|
22
|
|
|
|
|
70
|
my @attrs = qw{ name date time endtime duration lang |
|
465
|
|
|
|
|
|
|
price tickets restrictions locality venue }; |
|
466
|
22
|
|
|
|
|
39
|
my @req = qw{ name date time venue locality }; |
|
467
|
22
|
|
|
|
|
28
|
my @missing; |
|
468
|
22
|
|
|
|
|
37
|
foreach my $key ( @req ) { |
|
469
|
110
|
100
|
|
|
|
251
|
if ( ! defined ( $e->{$key} ) ) { |
|
470
|
39
|
|
|
|
|
69
|
push @missing, $key; |
|
471
|
|
|
|
|
|
|
} |
|
472
|
|
|
|
|
|
|
} |
|
473
|
22
|
100
|
|
|
|
103
|
warn $REQ_WARNING . join( ', ', @missing) . "\n" |
|
474
|
|
|
|
|
|
|
if ( defined( $missing[0] ) ); |
|
475
|
22
|
|
|
|
|
32
|
my $attrs = ''; |
|
476
|
22
|
|
|
|
|
34
|
foreach my $key ( @attrs ) { |
|
477
|
242
|
100
|
|
|
|
494
|
next unless defined $e->{$key}; |
|
478
|
148
|
|
|
|
|
290
|
$attrs .= " $key=\"$e->{$key}\"\n"; |
|
479
|
|
|
|
|
|
|
} |
|
480
|
22
|
|
|
|
|
62
|
my $desc = $e->desc(); |
|
481
|
22
|
|
|
|
|
46
|
my $who = $e->who_string(); |
|
482
|
22
|
|
|
|
|
49
|
my $what = $e->what_string(); |
|
483
|
22
|
50
|
|
|
|
93
|
my $by = "$bot" if defined $bot; |
|
484
|
22
|
|
|
|
|
43
|
my $event = ""; |
|
485
|
22
|
100
|
|
|
|
48
|
$event .= "$who\n" if $who; |
|
486
|
22
|
100
|
|
|
|
49
|
$event .= "$desc\n" if $desc; |
|
487
|
22
|
100
|
|
|
|
45
|
$event .= "$what\n" if $what; |
|
488
|
22
|
50
|
|
|
|
32
|
$event .= "$by\n" if $by; |
|
489
|
22
|
|
|
|
|
36
|
$event .= "\n"; |
|
490
|
22
|
|
|
|
|
147
|
return $event; |
|
491
|
|
|
|
|
|
|
} |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
1; |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
__END__ |