ICal/Entry/Event.pm

filter: Statementstmt 100% 23 / 23 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 4 / 4 totaltotal 95.2% 40 / 42 CC 5 SCAR 6.5
CC
5
Cov
94%
optional_unique_properties
3.0
mandatory_unique_properties
2.1
optional_repeatable_properties
2.0
CRAP 1.9
« ICal/Entry/Journal.pm ↑ Summary ICal/Entry/Todo.pm »
1 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Data::ICal::Entry::Event;
5  
6 4 ▶use base qw/Data::ICal::Entry/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Data::ICal::Entry::Event - Represents an event in an iCalendar file
11  
12 =head1 SYNOPSIS
13  
14 my $vevent = Data::ICal::Entry::Event->new();
15 $vevent->add_properties(
16 summary => "my party",
17 description => "I'll cry if I want to",
18 # Dat*e*::ICal is not a typo here
19 dtstart => Date::ICal->new( epoch => time )->ical,
20 );
21  
22 $calendar->add_entry($vevent);
23  
24 $vevent->add_entry($alarm);
25  
26 =head1 DESCRIPTION
27  
28 A L<Data::ICal::Entry::Event> object represents a single event in an
29 iCalendar file. (Note that the iCalendar RFC refers to entries as
30 "components".) It is a subclass of L<Data::ICal::Entry> and accepts
31 all of its methods.
32  
33 =head1 METHODS
34  
35 =cut
36  
37 =head2 ical_entry_type
38  
39 Returns C<VEVENT>, its iCalendar entry name.
40  
41 =cut
42  
43 16 ▶sub ical_entry_type {'VEVENT'}
Subroutine ical_entry_type: called CC=1 SCAR=0.0
Pod documented
44  
45 =head2 mandatory_unique_properties
46  
47 The C<uid> property is mandatory if C<rfc_strict> was passed to
48 L<Data::ICal/new>.
49  
50 =cut
51  
52 255 ▶sub mandatory_unique_properties {
Subroutine mandatory_unique_properties: called CC=2 SCAR=7.2
Pod documented
53 255 my $self = shift;
54 255 ▶ return $self->rfc_strict ? ("uid") : ()
Branch: 1 branch
BranchTrueFalseTotal
$self->rfc_strict ? : 0 255 255
55 }
56  
57 =head2 optional_unique_properties
58  
59 According to the iCalendar standard, the following properties may be
60 specified at most one time for an event:
61  
62 class created description dtstart geo
63 last-modified location organizer priority
64 dtstamp sequence status summary transp
65 uid url recurrence-id
66  
67 In addition, C<dtend> and C<duration> may be specified at most once
68 each, but not both in the same entry (though this restriction is not
69 enforced).
70  
71 Or if C<< vcal10 => 1 >>:
72  
73 class dcreated completed description dtstart dtend
74 last-modified location rnum priority
75 sequence status summary transp
76 url uid
77  
78 =cut
79  
80 250 ▶sub optional_unique_properties {
Subroutine optional_unique_properties: called CC=3 SCAR=11.0
Pod documented
81 250 my $self = shift;
82 250 ▶ my @ret = $self->rfc_strict ? () : ("uid");
Branch: 1 branch
BranchTrueFalseTotal
$self->rfc_strict ? : 0 250 250
83 250 ▶ if (not $self->vcal10) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->vcal10) { } 100 150 250
84 100 push @ret, qw(
85 class created description dtstart geo
86 last-modified location organizer priority
87 dtstamp sequence status summary transp
88 url recurrence-id
89  
90 dtend duration
91 );
92 } else {
93 150 push @ret, qw(
94 class dcreated completed description dtstart dtend
95 last-modified location rnum priority
96 sequence status summary transp
97 url
98 );
99 }
100 250 return @ret;
101 }
102  
103 =head2 optional_repeatable_properties
104  
105 According to the iCalendar standard, the following properties may be
106 specified any number of times for an event:
107  
108 attach attendee categories comment
109 contact exdate exrule request-status related-to
110 resources rdate rrule
111  
112 Or if C<< vcal10 => 1 >>:
113  
114 aalarm attach attendee categories
115 dalarm exdate exrule malarm palarm related-to
116 resources rdate rrule
117  
118 =cut
119  
120 125 ▶sub optional_repeatable_properties {
Subroutine optional_repeatable_properties: called CC=2 SCAR=6.9
Pod documented
121 125 my $self = shift;
122 125 ▶ if (not $self->vcal10) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->vcal10) { } 50 75 125
123 50 qw(
124 attach attendee categories comment
125 contact exdate exrule request-status related-to
126 resources rdate rrule
127 );
128 } else {
129 75 qw(
130 aalarm attach attendee categories
131 dalarm exdate exrule malarm palarm related-to
132 resources rdate rrule
133 );
134 }
135 }
136  
137 =head1 SEE ALSO
138  
139 =over 4
140  
141 =item L<Data::ICal::DateTime>
142  
143 For date parsing and formatting, including denoting "all day" events,
144 considering using this module. Because it's a "mix in", you can still
145 use all the methods here as well as the new date handling methods it
146 defines.
147  
148 =back
149  
150 =head1 AUTHOR
151  
152 Best Practical Solutions, LLC E<lt>modules@bestpractical.comE<gt>
153  
154 =head1 LICENCE AND COPYRIGHT
155  
156 Copyright (c) 2005 - 2020, Best Practical Solutions, LLC. All rights reserved.
157  
158 This module is free software; you can redistribute it and/or
159 modify it under the same terms as Perl itself. See L<perlartistic>.
160  
161 =cut
162  
163 4 1;
« ICal/Entry/Journal.pm ↑ Summary ICal/Entry/Todo.pm »