File Coverage

blib/lib/Data/ICal/Entry/Todo.pm
Criterion Covered Total %
statement 22 22 100.0
branch 6 8 75.0
condition n/a
subroutine 7 7 100.0
pod 4 4 100.0
total 39 41 95.1


line stmt bran cond sub pod time code
1 10     10   255365 use warnings;
  10         52  
  10         295  
2 10     10   46 use strict;
  10         17  
  10         292  
3              
4             package Data::ICal::Entry::Todo;
5              
6 10     10   44 use base qw/Data::ICal::Entry/;
  10         16  
  10         3268  
7              
8             =head1 NAME
9              
10             Data::ICal::Entry::Todo - Represents a to-do entry in an iCalendar file
11              
12             =head1 SYNOPSIS
13              
14             my $vtodo = Data::ICal::Entry::Todo->new();
15             $vtodo->add_properties(
16             summary => "go to sleep",
17             status => 'INCOMPLETE',
18             # Dat*e*::ICal is not a typo here
19             dtstart => Date::ICal->new( epoch => time )->ical,
20             );
21              
22             $calendar->add_entry($vtodo);
23              
24             $vtodo->add_entry($alarm);
25              
26             =head1 DESCRIPTION
27              
28             A L object represents a single to-do entry in
29             an iCalendar file. (Note that the iCalendar RFC refers to entries as
30             "components".) It is a subclass of L and accepts
31             all of its methods.
32              
33             =head1 METHODS
34              
35             =cut
36              
37             =head2 ical_entry_type
38              
39             Returns C, its iCalendar entry name.
40              
41             =cut
42              
43 42     42 1 133 sub ical_entry_type {'VTODO'}
44              
45             =head2 mandatory_unique_properties
46              
47             The C property is mandatory if C was passed to
48             L.
49              
50             =cut
51              
52             sub mandatory_unique_properties {
53 87     87 1 117 my $self = shift;
54 87 50       163 return $self->rfc_strict ? ("uid") : ()
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 a to-do item:
61              
62             class completed created description dtstamp
63             dtstart geo last-modified location organizer
64             percent-complete priority recurrence-id sequence status
65             summary uid url
66              
67             In addition, C and C 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 due
74             last-modified location rnum priority
75             sequence status summary transp
76             url uid
77              
78             =cut
79              
80             sub optional_unique_properties {
81 66     66 1 309 my $self = shift;
82 66 50       107 my @ret = $self->rfc_strict ? () : ("uid");
83 66 100       548 if (not $self->vcal10) {
84 62         593 push @ret, qw(
85             class completed created description dtstamp
86             dtstart geo last-modified location organizer
87             percent-complete priority recurrence-id sequence status
88             summary uid url
89              
90             due duration
91             );
92             } else {
93 4         38 push @ret, qw(
94             class dcreated completed description dtstart due
95             last-modified location rnum priority
96             sequence status summary transp
97             url uid
98             );
99             }
100 66         241 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 a to-do item:
107              
108             attach attendee categories comment contact
109             exdate exrule request-status related-to resources
110             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             sub optional_repeatable_properties {
121 33     33 1 52 my $self = shift;
122 33 100       64 if (not $self->vcal10) {
123 31         298 qw(
124             attach attendee categories comment contact
125             exdate exrule request-status related-to resources
126             rdate rrule
127             );
128             } else {
129 2         36 qw(
130             aalarm attach attendee categories
131             dalarm exdate exrule malarm palarm related-to
132             resources rdate rrule
133             );
134             }
135             }
136              
137             =head1 AUTHOR
138              
139             Best Practical Solutions, LLC Emodules@bestpractical.comE
140              
141             =head1 LICENCE AND COPYRIGHT
142              
143             Copyright (c) 2005 - 2019, Best Practical Solutions, LLC. All rights reserved.
144              
145             This module is free software; you can redistribute it and/or
146             modify it under the same terms as Perl itself. See L.
147              
148             =cut
149              
150             1;