line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OurCal::Event; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
249
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
OurCal::Event - an event class for OurCal |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 METHODS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head2 new |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Requires a description and a date (in C form. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Can also take id, recurring (boolean) and editable (boolean) params. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
0
|
|
|
0
|
1
|
|
my ($class, %event) = @_; |
22
|
0
|
|
|
|
|
|
return bless \%event, $class; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 description |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
The description of the event |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub description { |
32
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
33
|
0
|
|
|
|
|
|
return $self->_trim($self->{description}); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 date |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The date of the event in C form. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub date { |
44
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
return $self->{date}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 id |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
The id of the event (may return undef). |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub id { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
0
|
|
|
|
|
|
return $self->{id}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 recurring |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Is the event recurring |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub recurring { |
66
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
67
|
0
|
|
0
|
|
|
|
return $self->{recurring} || 0; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 editable |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Is this event editable. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub editable { |
77
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
78
|
0
|
|
0
|
|
|
|
return $self->{editable} || 0; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _trim { |
83
|
0
|
|
|
0
|
|
|
my($self, $text) = @_; |
84
|
0
|
|
|
|
|
|
$text =~ s/^\s*(.+=?)\$/$1/; |
85
|
0
|
|
|
|
|
|
return $text; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|