Lectionary/Day.pm

filter: Statementstmt 95.7% 494 / 516 Branchbran 97.5% 275 / 282 Conditioncond 97.9% 94 / 96 MC/DCmcdc 96.8% 61 / 63 Subroutinesub 79.1% 53 / 67 Podpod 100% 1 / 1 totaltotal 95.4% 978 / 1025 CC 176 SCAR 32.0
CC
176
Cov
97%
_buildMoveableDays
61.0
_determineOrdinary
29.0
_determineDay
20.0
CRAP 24.5
↑ Summary Lectionary/Year.pm »
1 package Date::Lectionary::Day;
2  
3 10 ▶use v5.22;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use MooseX::Aliases;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use Try::Catch;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶use Time::Piece;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 10 ▶use Time::Seconds;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 10 ▶use Date::Advent;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 10 ▶use Date::Easter;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 10 ▶use Date::Lectionary::Time qw(nextSunday prevSunday closestSunday);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 10 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 10 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 10 ▶use File::Share ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 10 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 =head1 NAME
23  
24 Date::Lectionary::Day - Determines the Day in the Christian Liturgical Year
25  
26 =head1 VERSION
27  
28 Version 1.20200203
29  
30 =cut
31  
32 10 ▶use version; our $VERSION = version->declare("v1.20200203");
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 =head1 SYNOPSIS
35  
36 A helper object for Date::Lectionary to determine the liturgical name(s) and type for the given day according to a given lectionary.
37  
38 =cut
39  
40 10 enum 'DayType', [qw(fixedFeast moveableFeast Sunday noLect)];
41 10 enum 'LectionaryType', [qw(acna rcl)];
42 10 enum 'MultiLect', [qw(yes no)];
43 10 enum 'IncludeFeasts', [qw(yes no)];
44 10 enum 'XianSeason', [qw(Advent Christmas Epiphany Ordinary Lent Easter Pentecost NaN)];
45 10 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 =head1 SUBROUTINES/METHODS/ATTRIBUTES
48  
49 =head2 ATTRIBUTES
50  
51 =head3 date
52  
53 The Time::Piece object date given at object construction.
54  
55 =head3 lectionary
56  
57 An optional attribute given at object creation time. Valid values are 'acna' for the Anglican Church of North America lectionary and 'rcl' for the Revised Common Lectionary. This attribute defaults to 'acna' if no value is given.
58  
59 =head3 type
60  
61 Stores the type of liturgical day. 'fixedFeast' is returned for non-moveable feast days such as Christmas Day. 'moveableFeast' is returned for moveable feast days. Moveable feasts move to a Monday when they occure on a Sunday. 'Sunday' is returned for non-fixed feast Sundays of the liturgical year. 'noLect' is returned for days with no feast day or Sunday readings.
62  
63 =head3 name
64  
65 The name of the day in the lectionary. For noLect days a String representation of the day is returned as the name.
66  
67 =head3 alt
68  
69 The alternative name --- if one is given --- of the day in the lectionary. If there is no alternative name for the day, then the empty string will be returned.
70  
71 =head3 multiLect
72  
73 Returns 'yes' if the day has multiple services with readings associated with it. (E.g. Christmas Day, Easter, etc.) Returns 'no' if the day is a normal lectioanry day with only one service and one set of readings.
74  
75 =head3 subLects
76  
77 An ArrayRef of the names of the multiple services that occur on a multiLect day.
78  
79 =head3 includeFeasts
80  
81 If this is set to 'yes' --- the default value --- the module will include fixed and moveable feasts in its determination of which liturgical Sunday it is.
82  
83 If set to 'no', it will exclude fixed and moveable feasts. Excluding feasts is useful when using Date::Lectionary::Day in combination with a daily lectionary such as Date::Lectioary::Daily where a fixed feast such as The Transfiguration can conflict with determining the Sunday to use for the daily lectionary.
84  
85 =head3 season
86  
87 The liturgical season the day falls within.
88  
89 Valid values are 'Advent', 'Christmas', 'Epiphany', 'Ordinary', 'Lent', 'Easter', or 'Pentecost'.
90  
91 If a date is given that is not a Sunday nor a pricipal holy day 'NaN' will be given for the season.
92  
93 =cut
94  
95 10 has 'date' => (
96 is => 'ro',
97 isa => 'Time::Piece',
98 required => 1,
99 );
100  
101 10 has 'type' => (
102 is => 'ro',
103 isa => 'DayType',
104 writer => '_setType',
105 init_arg => undef,
106 );
107  
108 10 has 'lectionary' => (
109 is => 'ro',
110 isa => 'LectionaryType',
111 default => 'acna',
112 );
113  
114 10 has 'displayName' => (
115 is => 'ro',
116 isa => 'Str',
117 writer => '_setDisplayName',
118 init_arg => undef,
119 alias => 'name',
120 );
121  
122 10 has 'altName' => (
123 is => 'ro',
124 isa => 'Str',
125 writer => '_setAltName',
126 init_arg => undef,
127 alias => 'alt',
128 );
129  
130 10 has 'commonName' => (
131 is => 'ro',
132 isa => 'Str',
133 writer => '_setCommonName',
134 init_arg => undef,
135 );
136  
137 10 has 'multiLect' => (
138 is => 'ro',
139 isa => 'MultiLect',
140 writer => '_setMultiLect',
141 init_arg => undef,
142 );
143  
144 10 has 'subLects' => (
145 is => 'ro',
146 isa => 'ArrayRef',
147 writer => '_setSubLects',
148 init_arg => undef,
149 );
150  
151 10 has 'includeFeasts' => (
152 is => 'ro',
153 isa => 'IncludeFeasts',
154 default => 'yes',
155 );
156  
157 10 has 'season' => (
158 is => 'ro',
159 isa => 'XianSeason',
160 writer => '_setSeason',
161 init_arg => undef,
162 );
163  
164 =head2 BUILD
165  
166 Constructor for the Date::Lectionary object. Takes a Time::Piect object, C<date>, to create the object.
167  
168 =cut
169  
170 625 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod documented
171 625 my $self = shift;
172  
173 625 my $advent = _determineAdvent( $self->date );
174 625 my $easter = _determineEaster( $advent->firstSunday->year + 1 );
175  
176 625 my %commonNameInfo = _determineDay( $self->date, $self->lectionary, $self->includeFeasts, $advent, $easter );
177 625 $self->_setCommonName( $commonNameInfo{commonName} );
178 625 $self->_setDisplayName( _determineDisplayName( $self->lectionary, $commonNameInfo{commonName} ) );
179 625 $self->_setAltName( _determineAltName( $self->lectionary, $commonNameInfo{commonName} ) );
180  
181 625 $self->_setType( $commonNameInfo{type} );
182 625 $self->_setSeason( $commonNameInfo{season} );
183  
184 625 my %multiLectInfo = _determineMultiLect( $self->lectionary, $commonNameInfo{commonName} );
185 625 $self->_setMultiLect( $multiLectInfo{multiLect} );
186 625 $self->_setSubLects( $multiLectInfo{multiNames} );
187 }
188  
189 =head2 _determineMultiLect
190  
191 Private method to determine if the day has multiple lectionary services and readings for the day.
192  
193 =cut
194  
195 625 ▶sub _determineMultiLect {
Subroutine _determineMultiLect: called CC=1 SCAR=0.0
196 625 my $tradition = shift;
197 625 my $commonName = shift;
198  
199 625 my $parser = XML::LibXML->new();
200 625 my $data_location;
201 my $lectionary;
202  
203 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
204 625 $data_location = dist_file( 'Date-Lectionary', 'date_lectionary_xref.xml' );
205 625 $lectionary = $parser->parse_file($data_location);
206 }
207 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
208 0 confess "The lectionary cross reference file could not be found or parsed.";
209 625 };
210  
211 625 my $compiled_xpath;
212  
213 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
214 625 $compiled_xpath = XML::LibXML::XPathExpression->new("/xref/day[\@multi=\"$commonName\"]/alt[\@type='$tradition']");
215 }
216 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
217 0 confess "The XPATH expression to to query the cross reference database could not be compiled.";
218 625 };
219  
220 625 my @multiNames;
221  
222 625 ▶ try {
Subroutine __ANON__: called CC=3 SCAR=11.0
223 625 ▶ if ( $lectionary->exists($compiled_xpath) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lectionary->exists($compiled_xpath)) { } 30 595 625
224 30 my @nodes = $lectionary->findnodes($compiled_xpath);
225 30 foreach my $node (@nodes) {
226 90 push( @multiNames, $node->textContent );
227 }
228 30 return ( multiLect => 'yes', multiNames => \@multiNames );
229 }
230 else {
231 595 return ( multiLect => 'no', multiNames => \@multiNames );
232 }
233 }
234 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
235 0 confess "An unpected error occured while querying the cross reference database.";
236 625 };
237 }
238  
239 =head2 _determineDisplayName
240  
241 Private method to determine the unique display name for the day.
242  
243 =cut
244  
245 625 ▶sub _determineDisplayName {
Subroutine _determineDisplayName: called CC=1 SCAR=0.0
246 625 my $tradition = shift;
247 625 my $commonName = shift;
248  
249 625 my $parser = XML::LibXML->new();
250 625 my $data_location;
251 my $lectionary;
252  
253 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
254 625 $data_location = dist_file( 'Date-Lectionary', 'date_lectionary_xref.xml' );
255 625 $lectionary = $parser->parse_file($data_location);
256 }
257 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
258 0 confess "The lectionary cross reference file could not be found or parsed.";
259 625 };
260  
261 625 my $compiled_xpath;
262 my $multi_xpath;
263  
264 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
265 625 $compiled_xpath = XML::LibXML::XPathExpression->new("/xref/day[\@name=\"$commonName\"]/alt[\@type='$tradition']");
266 625 $multi_xpath = XML::LibXML::XPathExpression->new("/xref/day[\@multi=\"$commonName\"]");
267 }
268 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
269 0 confess "The XPATH expression to to query the cross reference database could not be compiled.";
270 625 };
271  
272 625 my $displayName;
273  
274 625 ▶ try {
Subroutine __ANON__: called CC=3 SCAR=11.0
275 625 $displayName = $lectionary->findvalue($compiled_xpath);
276  
277 625 ▶ if ( $lectionary->exists($multi_xpath) ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($lectionary->exists($multi_xpath)) { } 30 595 625
elsif ($displayName eq '') { } 82 513 595
278 30 return $commonName;
279 }
280 elsif ( $displayName eq '' ) {
281 82 return $commonName;
282 }
283 else {
284 513 return $displayName;
285 }
286 }
287 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
288 0 confess "An unpected error occured while querying the cross reference database.";
289 625 };
290  
291 }
292  
293 =head2 _determineAltName
294  
295 Private method to determine if the day has any alternative names for the day.
296  
297 =cut
298  
299 625 ▶sub _determineAltName {
Subroutine _determineAltName: called CC=1 SCAR=0.1
300 625 my $tradition = shift;
301 625 my $commonName = shift;
302  
303 625 my $parser = XML::LibXML->new();
304 625 my $data_location;
305 my $lectionary;
306  
307 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
308 625 $data_location = dist_file( 'Date-Lectionary', 'date_lectionary_xref.xml' );
309 625 $lectionary = $parser->parse_file($data_location);
310 }
311 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
312 0 confess "The lectionary cross reference file could not be found or parsed.";
313 625 };
314  
315 625 my $compiled_xpath;
316 my $multi_xpath;
317  
318 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
319 625 $compiled_xpath = XML::LibXML::XPathExpression->new("/xref/day[\@name=\"$commonName\"]/alt[\@type='$tradition-alt']");
320 }
321 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
322 0 confess "The XPATH expression to to query the cross reference database could not be compiled.";
323 625 };
324  
325 625 my $altName;
326  
327 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
328 625 $altName = $lectionary->findvalue($compiled_xpath);
329 625 return $altName;
330 }
331 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
332 0 confess "An unpected error occured while querying the cross reference database.";
333 625 };
334  
335 }
336  
337 =head2 _determineAdvent
338  
339 Private method that takes a Time::Piece date object to returns a Date::Advent object containing the dates for Advent of the current liturgical year.
340  
341 =cut
342  
343 625 ▶sub _determineAdvent {
Subroutine _determineAdvent: called CC=1 SCAR=0.0
344 625 my $date = shift;
345  
346 625 my $advent = undef;
347  
348 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
349 625 $advent = Date::Advent->new( date => $date );
350 625 return $advent;
351 }
352 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
353 0 confess "Could not calculate Advent for the given date [" . $date->ymd . "].";
354 625 };
355 }
356  
357 =head2 _determineEaster
358  
359 Private method that takes a four-digit representation of a Common Era year and calculates the date for Easter as a Time::Piece object.
360  
361 =cut
362  
363 625 ▶sub _determineEaster {
Subroutine _determineEaster: called CC=1 SCAR=0.0
364 625 my $easterYear = shift;
365  
366 625 my $easter = undef;
367  
368 625 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
369 625 my ( $easterMonth, $easterDay ) = easter($easterYear);
370 625 $easter = Time::Piece->strptime( $easterYear . "-" . $easterMonth . "-" . $easterDay, "%Y-%m-%d" );
371 625 return $easter;
372 }
373 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
374 0 confess "Could not calculate Easter for the year [" . $easterYear . "]";
375 625 };
376 }
377  
378 =head2 _determineFeasts
379  
380 Private method that takes the Time::Piece date given at construction and determines if the date is one of many feasts in the liturgical calendar. Feasts are taken from the Anglican Church in North America's revision of the revised common lectionary.
381  
382 =cut
383  
384 524 ▶sub _determineFeasts {
Subroutine _determineFeasts: called CC=6 SCAR=17.9
385 524 my $date = shift;
386 524 my $lectionary = shift;
387  
388 524 my $yesterday = $date - ONE_DAY;
389  
390 524 my $yesterdayName;
391 524 ▶ if ( $yesterday->wday == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($yesterday->wday == 1) 27 497 524
392 27 $yesterdayName = _buildMoveableDays( $yesterday, $lectionary );
393 }
394  
395 524 ▶ if ($yesterdayName) {
Branch: 1 branch
BranchTrueFalseTotal
if ($yesterdayName) 17 507 524
396 return (
397 17 commonName => $yesterdayName,
398 type => 'moveableFeast',
399 season => 'NaN'
400 );
401 }
402  
403 507 my $fixedDayName = _buildFixedDays( $date, $lectionary );
404 507 ▶ if ($fixedDayName) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fixedDayName) 25 482 507
405 return (
406 commonName => $fixedDayName->{commonName},
407 type => 'fixedFeast',
408 season => $fixedDayName->{season}
409 25 );
410 }
411  
412 482 my $moveableDayName = _buildMoveableDays( $date, $lectionary );
413 482 ▶ if ( $moveableDayName && $date->wday != 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($moveableDayName and $date->wday != 1) 28 454 482
Condition100%3/3
$moveableDayName and $date->wday != 1
!ll&&!rl&&r
4371728
MC/DC100%2/2
$moveableDayName and $date->wday != 1
$moveableDayName $date->wday != 1
Truth table100%3/3
A and B
A= $moveableDayNameB= $date->wday != 1
ABresult
0X0
100
111
414 return (
415 28 commonName => $moveableDayName,
416 type => 'moveableFeast',
417 season => 'NaN'
418 );
419 }
420  
421 454 return ( commonName => undef, type => undef, season => 'NaN' );
422 }
423  
424 =head2 _buildMoveableDays
425  
426 Private method that takes the Time::Piece date given at construction and determines if the date is one of many moveable feasts in the liturgical calendar. Feasts are taken from the Anglican Church in North America's revision of the revised common lectionary.
427  
428 =cut
429  
430 509 ▶sub _buildMoveableDays {
Subroutine _buildMoveableDays: called CC=61 SCAR=41.1
431 509 my $date = shift;
432 509 my $lectionary = shift;
433  
434 #Moveable holidays in January
435 509 ▶ if ( $date->mon == 1 ) {
Branch: 12 branches
BranchTrueFalseTotal
if ($date->mon == 1) { } 57 452 509
elsif ($date->mon == 2) { } 48 404 452
elsif ($date->mon == 3) { } 36 368 404
elsif ($date->mon == 4) { } 34 334 368
elsif ($date->mon == 5) { } 43 291 334
elsif ($date->mon == 6) { } 41 250 291
elsif ($date->mon == 7) { } 49 201 250
elsif ($date->mon == 8) { } 41 160 201
elsif ($date->mon == 9) { } 42 118 160
elsif ($date->mon == 10) { } 51 67 118
elsif ($date->mon == 11) { } 46 21 67
elsif ($date->mon == 12) { } 21 0 21
436 57 ▶ if ( $date->mday == 18 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 18 and $lectionary eq "acna") 4 53 57
Condition100%3/3
$date->mday == 18 and $lectionary eq "acna"
!ll&&!rl&&r
5124
MC/DC100%2/2
$date->mday == 18 and $lectionary eq "acna"
$date->mday == 18 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 18B= $lectionary eq "acna"
ABresult
0X0
100
111
437 4 return "Confession of St. Peter";
438 }
439 53 ▶ if ( $date->mday == 25 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 25 and $lectionary eq "acna") 4 49 53
Condition100%3/3
$date->mday == 25 and $lectionary eq "acna"
!ll&&!rl&&r
4724
MC/DC100%2/2
$date->mday == 25 and $lectionary eq "acna"
$date->mday == 25 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 25B= $lectionary eq "acna"
ABresult
0X0
100
111
440 4 return "Conversion of St. Paul";
441 }
442 }
443  
444 #Moveable holidays in February
445 elsif ( $date->mon == 2 ) {
446 48 ▶ if ( $date->mday == 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 2) 4 44 48
447 4 return "The Presentation of Christ in the Temple";
448 }
449 44 ▶ if ( $date->mday == 24 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 24 and $lectionary eq "acna") 2 42 44
Condition100%3/3
$date->mday == 24 and $lectionary eq "acna"
!ll&&!rl&&r
4022
MC/DC100%2/2
$date->mday == 24 and $lectionary eq "acna"
$date->mday == 24 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 24B= $lectionary eq "acna"
ABresult
0X0
100
111
450 2 return "St. Matthias";
451 }
452 }
453  
454 #Moveable holidays in March
455 elsif ( $date->mon == 3 ) {
456 36 ▶ if ( $date->mday == 19 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 19 and $lectionary eq "acna") 4 32 36
Condition100%3/3
$date->mday == 19 and $lectionary eq "acna"
!ll&&!rl&&r
3024
MC/DC100%2/2
$date->mday == 19 and $lectionary eq "acna"
$date->mday == 19 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 19B= $lectionary eq "acna"
ABresult
0X0
100
111
457 4 return "St. Joseph";
458 }
459 32 ▶ if ( $date->mday == 25 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 25) 2 30 32
460 2 return "The Annunciation";
461 }
462 }
463  
464 #Moveable holidays in April
465 elsif ( $date->mon == 4 ) {
466 34 ▶ if ( $date->mday == 25 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 25 and $lectionary eq "acna") 1 33 34
Condition100%3/3
$date->mday == 25 and $lectionary eq "acna"
!ll&&!rl&&r
3211
MC/DC100%2/2
$date->mday == 25 and $lectionary eq "acna"
$date->mday == 25 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 25B= $lectionary eq "acna"
ABresult
0X0
100
111
467 1 return "St. Mark";
468 }
469 }
470  
471 #Moveable holidays in May
472 elsif ( $date->mon == 5 ) {
473 43 ▶ if ( $date->mday == 1 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 1 and $lectionary eq "acna") 4 39 43
Condition100%3/3
$date->mday == 1 and $lectionary eq "acna"
!ll&&!rl&&r
3724
MC/DC100%2/2
$date->mday == 1 and $lectionary eq "acna"
$date->mday == 1 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 1B= $lectionary eq "acna"
ABresult
0X0
100
111
474 4 return "St. Philip & St. James";
475 }
476 39 ▶ if ( $date->mday == 31 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 31) 6 33 39
477 6 return "The Visitation";
478 }
479 }
480  
481 #Moveable holidays in June
482 elsif ( $date->mon == 6 ) {
483 41 ▶ if ( $date->mday == 11 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 11 and $lectionary eq "acna") 4 37 41
Condition100%3/3
$date->mday == 11 and $lectionary eq "acna"
!ll&&!rl&&r
3524
MC/DC100%2/2
$date->mday == 11 and $lectionary eq "acna"
$date->mday == 11 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 11B= $lectionary eq "acna"
ABresult
0X0
100
111
484 4 return "St. Barnabas";
485 }
486 37 ▶ if ( $date->mday == 24 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 24 and $lectionary eq "acna") 1 36 37
Condition100%3/3
$date->mday == 24 and $lectionary eq "acna"
!ll&&!rl&&r
3511
MC/DC100%2/2
$date->mday == 24 and $lectionary eq "acna"
$date->mday == 24 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 24B= $lectionary eq "acna"
ABresult
0X0
100
111
487 1 return "Nativity of St. John the Baptist";
488 }
489 36 ▶ if ( $date->mday == 29 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 29 and $lectionary eq "acna") 1 35 36
Condition100%3/3
$date->mday == 29 and $lectionary eq "acna"
!ll&&!rl&&r
3411
MC/DC100%2/2
$date->mday == 29 and $lectionary eq "acna"
$date->mday == 29 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 29B= $lectionary eq "acna"
ABresult
0X0
100
111
490 1 return "St. Peter & St. Paul";
491 }
492 }
493  
494 #Moveable holidays in July
495 elsif ( $date->mon == 7 ) {
496 49 ▶ if ( $date->mday == 22 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 22 and $lectionary eq "acna") 2 47 49
Condition100%3/3
$date->mday == 22 and $lectionary eq "acna"
!ll&&!rl&&r
4612
MC/DC100%2/2
$date->mday == 22 and $lectionary eq "acna"
$date->mday == 22 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 22B= $lectionary eq "acna"
ABresult
0X0
100
111
497 2 return "St. Mary Magdalene";
498 }
499 47 ▶ if ( $date->mday == 25 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 25 and $lectionary eq "acna") 1 46 47
Condition100%3/3
$date->mday == 25 and $lectionary eq "acna"
!ll&&!rl&&r
4511
MC/DC100%2/2
$date->mday == 25 and $lectionary eq "acna"
$date->mday == 25 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 25B= $lectionary eq "acna"
ABresult
0X0
100
111
500 1 return "St. James";
501 }
502 }
503  
504 #Moveable holidays in August
505 elsif ( $date->mon == 8 ) {
506 41 ▶ if ( $date->mday == 15 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 15 and $lectionary eq "acna") 1 40 41
Condition100%3/3
$date->mday == 15 and $lectionary eq "acna"
!ll&&!rl&&r
3911
MC/DC100%2/2
$date->mday == 15 and $lectionary eq "acna"
$date->mday == 15 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 15B= $lectionary eq "acna"
ABresult
0X0
100
111
507 1 return "St. Mary the Virgin";
508 }
509 40 ▶ if ( $date->mday == 24 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 24 and $lectionary eq "acna") 1 39 40
Condition100%3/3
$date->mday == 24 and $lectionary eq "acna"
!ll&&!rl&&r
3811
MC/DC100%2/2
$date->mday == 24 and $lectionary eq "acna"
$date->mday == 24 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 24B= $lectionary eq "acna"
ABresult
0X0
100
111
510 1 return "St. Bartholomew";
511 }
512 }
513  
514 #Moveable holidays in September
515 elsif ( $date->mon == 9 ) {
516 42 ▶ if ( $date->mday == 14 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 14) 2 40 42
517 2 return "Holy Cross Day";
518 }
519 40 ▶ if ( $date->mday == 21 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 21 and $lectionary eq "acna") 1 39 40
Condition100%3/3
$date->mday == 21 and $lectionary eq "acna"
!ll&&!rl&&r
3811
MC/DC100%2/2
$date->mday == 21 and $lectionary eq "acna"
$date->mday == 21 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 21B= $lectionary eq "acna"
ABresult
0X0
100
111
520 1 return "St. Matthew";
521 }
522 39 ▶ if ( $date->mday == 29 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 29 and $lectionary eq "acna") 1 38 39
Condition100%3/3
$date->mday == 29 and $lectionary eq "acna"
!ll&&!rl&&r
3711
MC/DC100%2/2
$date->mday == 29 and $lectionary eq "acna"
$date->mday == 29 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 29B= $lectionary eq "acna"
ABresult
0X0
100
111
523 1 return "Holy Michael & All Angels";
524 }
525 }
526  
527 #Moveable holidays in October
528 elsif ( $date->mon == 10 ) {
529 51 ▶ if ( $date->mday == 18 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 18 and $lectionary eq "acna") 6 45 51
Condition100%3/3
$date->mday == 18 and $lectionary eq "acna"
!ll&&!rl&&r
4236
MC/DC100%2/2
$date->mday == 18 and $lectionary eq "acna"
$date->mday == 18 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 18B= $lectionary eq "acna"
ABresult
0X0
100
111
530 6 return "St. Luke";
531 }
532 45 ▶ if ( $date->mday == 28 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 28 and $lectionary eq "acna") 1 44 45
Condition100%3/3
$date->mday == 28 and $lectionary eq "acna"
!ll&&!rl&&r
4311
MC/DC100%2/2
$date->mday == 28 and $lectionary eq "acna"
$date->mday == 28 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 28B= $lectionary eq "acna"
ABresult
0X0
100
111
533 1 return "St. Simon & St. Jude";
534 }
535 }
536  
537 #Moveable holidays in November
538 elsif ( $date->mon == 11 ) {
539 46 ▶ if ( $date->mday == 30 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 30 and $lectionary eq "acna") 1 45 46
Condition100%3/3
$date->mday == 30 and $lectionary eq "acna"
!ll&&!rl&&r
4411
MC/DC100%2/2
$date->mday == 30 and $lectionary eq "acna"
$date->mday == 30 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 30B= $lectionary eq "acna"
ABresult
0X0
100
111
540 1 return "St. Andrew";
541 }
542 }
543  
544 #Moveable holidays in December
545 elsif ( $date->mon == 12 ) {
546 21 ▶ if ( $date->mday == 21 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 21 and $lectionary eq "acna") 1 20 21
Condition100%3/3
$date->mday == 21 and $lectionary eq "acna"
!ll&&!rl&&r
1911
MC/DC100%2/2
$date->mday == 21 and $lectionary eq "acna"
$date->mday == 21 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 21B= $lectionary eq "acna"
ABresult
0X0
100
111
547 1 return "St. Thomas";
548 }
549 20 ▶ if ( $date->mday == 26 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 26 and $lectionary eq "acna") 2 18 20
Condition100%3/3
$date->mday == 26 and $lectionary eq "acna"
!ll&&!rl&&r
1712
MC/DC100%2/2
$date->mday == 26 and $lectionary eq "acna"
$date->mday == 26 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 26B= $lectionary eq "acna"
ABresult
0X0
100
111
550 2 return "St. Stephen";
551 }
552 18 ▶ if ( $date->mday == 27 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 27 and $lectionary eq "acna") 4 14 18
Condition100%3/3
$date->mday == 27 and $lectionary eq "acna"
!ll&&!rl&&r
1224
MC/DC100%2/2
$date->mday == 27 and $lectionary eq "acna"
$date->mday == 27 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 27B= $lectionary eq "acna"
ABresult
0X0
100
111
553 4 return "St. John";
554 }
555 14 ▶ if ( $date->mday == 28 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 28 and $lectionary eq "acna") 1 13 14
Condition100%3/3
$date->mday == 28 and $lectionary eq "acna"
!ll&&!rl&&r
1121
MC/DC100%2/2
$date->mday == 28 and $lectionary eq "acna"
$date->mday == 28 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 28B= $lectionary eq "acna"
ABresult
0X0
100
111
556 1 return "Holy Innocents";
557 }
558 }
559 else {
560 0 confess "Date [" . $date->ymd . "] is not a known or valid date.";
561 }
562 }
563  
564 =head2 _buildFixedDays
565  
566 Private method that takes the Time::Piece date given at construction and determines if the date is one of many fixed (non-moveable) feasts in the liturgical calendar. Fixed feasts are taken from the Anglican Church in North America's revision of the revised common lectionary.
567  
568 =cut
569  
570 507 ▶sub _buildFixedDays {
Subroutine _buildFixedDays: called CC=19 SCAR=29.5
571 507 my $date = shift;
572 507 my $lectionary = shift;
573  
574 #Fixed holidays in January
575 507 ▶ if ( $date->mon == 1 ) {
Branch: 12 branches
BranchTrueFalseTotal
if ($date->mon == 1) { } 60 447 507
elsif ($date->mon == 2) { } 48 399 447
elsif ($date->mon == 3) { } 33 366 399
elsif ($date->mon == 4) { } 34 332 366
elsif ($date->mon == 5) { } 37 295 332
elsif ($date->mon == 6) { } 38 257 295
elsif ($date->mon == 7) { } 48 209 257
elsif ($date->mon == 8) { } 44 165 209
elsif ($date->mon == 9) { } 42 123 165
elsif ($date->mon == 10) { } 48 75 123
elsif ($date->mon == 11) { } 50 25 75
elsif ($date->mon == 12) { } 25 0 25
576 60 ▶ if ( $date->mday == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 1) 6 54 60
577 return {
578 6 commonName => "Holy Name",
579 season => 'Christmas'
580 };
581 }
582 54 ▶ if ( $date->mday == 6 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 6) 4 50 54
583 return {
584 4 commonName => "The Epiphany",
585 season => 'Epiphany'
586 };
587 }
588 }
589  
590 #Fixed holidays in February
591 elsif ( $date->mon == 2 ) {
592 }
593  
594 #Fixed holidays in March
595 elsif ( $date->mon == 3 ) {
596 }
597  
598 #Fixed holidays in April
599 elsif ( $date->mon == 4 ) {
600 }
601  
602 #Fixed holidays in May
603 elsif ( $date->mon == 5 ) {
604 }
605  
606 #Fixed holidays in June
607 elsif ( $date->mon == 6 ) {
608 }
609  
610 #Fixed holidays in July
611 elsif ( $date->mon == 7 ) {
612 }
613  
614 #Fixed holidays in August
615 elsif ( $date->mon == 8 ) {
616 44 ▶ if ( $date->mday == 6 && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 6 and $lectionary eq "acna") 3 41 44
Condition100%3/3
$date->mday == 6 and $lectionary eq "acna"
!ll&&!rl&&r
4013
MC/DC100%2/2
$date->mday == 6 and $lectionary eq "acna"
$date->mday == 6 $lectionary eq "acna"
Truth table100%3/3
A and B
A= $date->mday == 6B= $lectionary eq "acna"
ABresult
0X0
100
111
617 return {
618 3 commonName => "The Transfiguration",
619 season => 'Ordinary'
620 };
621 }
622 }
623  
624 #Fixed holidays in September
625 elsif ( $date->mon == 9 ) {
626 }
627  
628 #Fixed holidays in October
629 elsif ( $date->mon == 10 ) {
630 }
631  
632 #Fixed holidays in November
633 elsif ( $date->mon == 11 ) {
634 50 ▶ if ( $date->mday == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 1) 4 46 50
635 return {
636 4 commonName => "All Saints' Day",
637 season => 'Ordinary'
638 };
639 }
640 }
641  
642 #Fixed holidays in December
643 elsif ( $date->mon == 12 ) {
644 25 ▶ if ( $date->mday == 25 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->mday == 25) 8 17 25
645 return {
646 8 commonName => "Christmas Day",
647 season => 'Christmas'
648 };
649 }
650 }
651 else {
652 0 confess "Date [" . $date->ymd . "] is not a known or valid date.";
653 }
654 }
655  
656 =head2 _determineAshWednesday
657  
658 Private method that takes the Time::Piece date for Easter and determines the date for Ash Wednesday. Ash Wednesday is the start of Lent. It occurs 46 days before Easter for the given year.
659  
660 =cut
661  
662 576 ▶sub _determineAshWednesday {
Subroutine _determineAshWednesday: called CC=1 SCAR=0.0
663 576 my $easter = shift;
664  
665 576 my $ashWednesday = undef;
666  
667 576 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
668 576 my $secondsToSubtract = 46 * ONE_DAY;
669 576 $ashWednesday = $easter - $secondsToSubtract;
670 576 return $ashWednesday;
671 }
672 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
673 0 confess "Could not calculate Ash Wednesday for Easter [" . $easter->ymd . "].";
674 576 };
675 }
676  
677 =head2 _determineAscension
678  
679 Private method that takes the Time::Piece date for Easter and determines the date for Ascension. Ascension is forty days (inclusive) after Easter.
680  
681 =cut
682  
683 540 ▶sub _determineAscension {
Subroutine _determineAscension: called CC=1 SCAR=0.0
684 540 my $easter = shift;
685  
686 540 my $ascension = undef;
687  
688 540 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
689 540 my $secondsToAdd = 39 * ONE_DAY;
690 540 $ascension = $easter + $secondsToAdd;
691 540 return $ascension;
692 }
693 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
694 0 confess "Could not calculate Ascension for Easter [" . $easter->ymd . "].";
695 540 };
696 }
697  
698 =head2 _determinePentecost
699  
700 Private method the takes the Time::Piece date for Easter and determines the date for Pentecost. Pentecost is fifty days (inclusive) after Easter.
701  
702 =cut
703  
704 537 ▶sub _determinePentecost {
Subroutine _determinePentecost: called CC=1 SCAR=0.0
705 537 my $easter = shift;
706  
707 537 my $pentecost = undef;
708  
709 537 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
710 537 my $secondsToAdd = 49 * ONE_DAY;
711 537 $pentecost = $easter + $secondsToAdd;
712 537 return $pentecost;
713 }
714 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
715 0 confess "Could not calculate Pentecost for Easter [" . $easter->ymd . "].";
716 537 };
717 }
718  
719 =head2 _determineHolyWeek
720  
721 Private method used to return the names of various days within Holy Week. Takes the Time::Piece date given at construction and the Time::Piece date for Easter. Returns undef if the date given at construction is not found in Holy Week.
722  
723 =cut
724  
725 573 ▶sub _determineHolyWeek {
Subroutine _determineHolyWeek: called CC=8 SCAR=20.8
726 573 my $date = shift;
727 573 my $easter = shift;
728  
729 573 my $dateMark = $easter - ONE_DAY;
730 573 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 3 570 573
731 3 return "Holy Saturday";
732 }
733  
734 570 $dateMark = $dateMark - ONE_DAY;
735 570 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 3 567 570
736 3 return "Good Friday";
737 }
738  
739 567 $dateMark = $dateMark - ONE_DAY;
740 567 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 2 565 567
741 2 return "Maundy Thursday";
742 }
743  
744 565 $dateMark = $dateMark - ONE_DAY;
745 565 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 2 563 565
746 2 return "Wednesday in Holy Week";
747 }
748  
749 563 $dateMark = $dateMark - ONE_DAY;
750 563 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 2 561 563
751 2 return "Tuesday in Holy Week";
752 }
753  
754 561 $dateMark = $dateMark - ONE_DAY;
755 561 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 2 559 561
756 2 return "Monday in Holy Week";
757 }
758  
759 559 $dateMark = $dateMark - ONE_DAY;
760 559 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 9 550 559
761 9 return "Palm Sunday";
762 }
763  
764 550 return undef;
765 }
766  
767 =head2 _determineEasterWeek
768  
769 Private method used to return the names of various days within Easter Week. Takes the Time::Piece date given at construction and the Time::Piece date for Easter. Returns undef if the date given at construction is not found in Easter Week.
770  
771 =cut
772  
773 550 ▶sub _determineEasterWeek {
Subroutine _determineEasterWeek: called CC=7 SCAR=19.5
774 550 my $date = shift;
775 550 my $easter = shift;
776  
777 550 my $dateMark = $easter + ONE_DAY;
778 550 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 2 548 550
779 2 return "Monday of Easter Week";
780 }
781  
782 548 $dateMark = $dateMark + ONE_DAY;
783 548 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 4 544 548
784 4 return "Tuesday of Easter Week";
785 }
786  
787 544 $dateMark = $dateMark + ONE_DAY;
788 544 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 1 543 544
789 1 return "Wednesday of Easter Week";
790 }
791  
792 543 $dateMark = $dateMark + ONE_DAY;
793 543 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 1 542 543
794 1 return "Thursday of Easter Week";
795 }
796  
797 542 $dateMark = $dateMark + ONE_DAY;
798 542 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 1 541 542
799 1 return "Friday of Easter Week";
800 }
801  
802 541 $dateMark = $dateMark + ONE_DAY;
803 541 ▶ if ( $date == $dateMark ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMark) 1 540 541
804 1 return "Saturday of Easter Week";
805 }
806  
807 540 return undef;
808 }
809  
810 =head2 _hasChristmas2
811  
812 Private method to determine if there is a second Sunday of Christmas in the current liturgical year. Returns 1 when there is a second Sunday of Christmas and 0 otherwise.
813  
814 =cut
815  
816 80 ▶sub _hasChristmas2 {
Subroutine _hasChristmas2: called CC=2 SCAR=7.0
817 80 my $advent = shift;
818 80 my $epiphany = shift;
819  
820 80 my $firstChristmas = nextSunday( $advent->fourthSunday );
821 80 my $dateMarker = nextSunday($firstChristmas);
822  
823 80 ▶ if ( $dateMarker < $epiphany ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dateMarker < $epiphany) { } 66 14 80
824 66 return 1;
825 }
826 else {
827 14 return 0;
828 }
829  
830 0 return 0;
831 }
832  
833 =head2 _determineChristmasEpiphany
834  
835 Private method that matches the date given at construction against the Sundays in Christmastide and Epiphany. Returns a string representation of the name of the Sunday in the lectionary.
836  
837 =cut
838  
839 80 ▶sub _determineChristmasEpiphany {
Subroutine _determineChristmasEpiphany: called CC=17 SCAR=28.3
840 80 my $date = shift;
841  
842 80 my $advent = shift;
843  
844 80 my $ashWednesday = shift;
845  
846 80 my $lectionary = shift;
847  
848 80 my $epiphany = Time::Piece->strptime( $date->year . "-01-06", "%Y-%m-%d" );
849  
850 80 my $christmas2 = _hasChristmas2( $advent, $epiphany );
851  
852 #Is the date in Christmastide?
853 80 my $dateMarker = nextSunday( $advent->fourthSunday );
854 80 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 6 74 80
855 6 return "The First Sunday of Christmas";
856 }
857  
858 74 $dateMarker = nextSunday($dateMarker);
859 74 ▶ if ( $date == $dateMarker && $christmas2 == 1 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($date == $dateMarker and $christmas2 == 1) { } 6 68 74
elsif ($date == $dateMarker) { } 1 67 68
Condition100%3/3
$date == $dateMarker and $christmas2 == 1
!ll&&!rl&&r
6716
MC/DC100%2/2
$date == $dateMarker and $christmas2 == 1
$date == $dateMarker $christmas2 == 1
Truth table100%3/3
A and B
A= $date == $dateMarkerB= $christmas2 == 1
ABresult
0X0
100
111
860 6 return "The Second Sunday of Christmas";
861 }
862 elsif ( $date == $dateMarker ) {
863 1 return "The First Sunday of Epiphany";
864 }
865  
866 67 my @epiphanySundays = ( "The First Sunday of Epiphany", "The Second Sunday of Epiphany", "The Third Sunday of Epiphany", "The Fourth Sunday of Epiphany", "The Fifth Sunday of Epiphany", "The Sixth Sunday of Epiphany", "The Seventh Sunday of Epiphany", "The Last Sunday after Epiphany" );
867  
868 #Is the date in Epiphany?
869 67 my $sunCount = 0;
870 67 foreach my $sunday (@epiphanySundays) {
871 241 $dateMarker = nextSunday($dateMarker);
872 241 ▶ if ( $date == $dateMarker && $date == prevSunday($ashWednesday) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker and $date == prevSunday($ashWednesday)) 10 231 241
Condition100%3/3
$date == $dateMarker and $date == prevSunday($ashWednesday)
!ll&&!rl&&r
1745710
MC/DC100%2/2
$date == $dateMarker and $date == prevSunday($ashWednesday)
$date == $dateMarker $date == prevSunday($ashWednesday)
Truth table100%3/3
A and B
A= $date == $dateMarkerB= $date == prevSunday($ashWednesday)
ABresult
0X0
100
111
873 10 return "The Last Sunday after Epiphany";
874 }
875 231 ▶ if ( $date == $dateMarker && $date == prevSunday( prevSunday($ashWednesday) ) && $lectionary eq 'acna' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker and $date == prevSunday(prevSunday($ashWednesday)) and $lectionary eq "acna") 7 224 231
Condition100%6/6
$date == $dateMarker and $date == prevSunday(prevSunday($ashWednesday)) and $lectionary eq "acna"
!ll&&!rl&&r
22137
$date == $dateMarker and $date == prevSunday(prevSunday($ashWednesday))
!ll&&!rl&&r
1744710
MC/DC100%3/3
$date == $dateMarker and $date == prevSunday(prevSunday($ashWednesday)) and $lectionary eq "acna"
$date == $dateMarker $date == prevSunday(prevSunday($ashWednesday)) $lectionary eq "acna"
Truth table100%4/4
A and B and C
A= $date == $dateMarkerB= $date == prevSunday(prevSunday($ashWednesday))C= $lectionary eq "acna"
ABCresult
0XX0
10X0
1100
1111
876 7 return "The Second to Last Sunday after Epiphany";
877 }
878  
879 224 ▶ if ( $date == $dateMarker && $christmas2 == 1 ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($date == $dateMarker and $christmas2 == 1) { } 45 179 224
elsif ($date == $dateMarker and $epiphany->wday == 1) { } 2 177 179
elsif ($date == $dateMarker and $christmas2 == 0) { } 3 348 351
Condition100%3/3
$date == $dateMarker and $christmas2 == 1
!ll&&!rl&&r
174545
MC/DC100%2/2
$date == $dateMarker and $christmas2 == 1
$date == $dateMarker $christmas2 == 1
Truth table100%3/3
A and B
A= $date == $dateMarkerB= $christmas2 == 1
ABresult
0X0
100
111
880 45 return $epiphanySundays[$sunCount];
881 }
882 ▶ elsif ( $date == $dateMarker && $epiphany->wday == 1 ) {
Condition100%3/3
$date == $dateMarker and $epiphany->wday == 1
!ll&&!rl&&r
17432
MC/DC100%2/2
$date == $dateMarker and $epiphany->wday == 1
$date == $dateMarker $epiphany->wday == 1
Truth table100%3/3
A and B
A= $date == $dateMarkerB= $epiphany->wday == 1
ABresult
0X0
100
111
883 2 return $epiphanySundays[$sunCount];
884 }
885 ▶ elsif ( $date == $dateMarker && $christmas2 == 0 ) {
Condition66%2/3
$date == $dateMarker and $christmas2 == 0
!ll&&!rl&&r
17403
MC/DC50%1/2
$date == $dateMarker and $christmas2 == 0
$date == $dateMarker $christmas2 == 0
Truth table66%2/3
A and B
A= $date == $dateMarkerB= $christmas2 == 0
ABresult
0X0
100
111
886 3 return $epiphanySundays[ $sunCount + 1 ];
887 }
888  
889 174 $sunCount++;
890 }
891  
892 0 confess "There are no further Sundays of Christmastide or Epiphany.";
893 }
894  
895 =head2 _determineLent
896  
897 Private method that matches the date given at construction against the Sundays in Lent. Returns a string representation of the name of the Sunday in the lectionary.
898  
899 =cut
900  
901 46 ▶sub _determineLent {
Subroutine _determineLent: called CC=6 SCAR=17.9
902 46 my $date = shift;
903 46 my $ashWednesday = shift;
904  
905 46 my $dateMarker = nextSunday($ashWednesday);
906 46 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 10 36 46
907 10 return "The First Sunday in Lent";
908 }
909  
910 36 $dateMarker = nextSunday($dateMarker);
911 36 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 27 36
912 9 return "The Second Sunday in Lent";
913 }
914  
915 27 $dateMarker = nextSunday($dateMarker);
916 27 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 18 27
917 9 return "The Third Sunday in Lent";
918 }
919  
920 18 $dateMarker = nextSunday($dateMarker);
921 18 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 9 18
922 9 return "The Fourth Sunday in Lent";
923 }
924  
925 9 $dateMarker = nextSunday($dateMarker);
926 9 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 0 9
927 9 return "The Fifth Sunday in Lent";
928 }
929  
930 0 confess "There are no further Sundays in Lent";
931 }
932  
933 =head2 _determineEasterSeason
934  
935 Private method that matches the date given at construction against the Sundays in the Easter season. Returns a string representation of the name of the Sunday in the lectionary.
936  
937 =cut
938  
939 56 ▶sub _determineEasterSeason {
Subroutine _determineEasterSeason: called CC=7 SCAR=19.5
940 56 my $date = shift;
941 56 my $easter = shift;
942  
943 56 my $dateMarker = nextSunday($easter);
944 56 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 47 56
945 9 return "The Second Sunday of Easter";
946 }
947  
948 47 $dateMarker = nextSunday($dateMarker);
949 47 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 38 47
950 9 return "The Third Sunday of Easter";
951 }
952  
953 38 $dateMarker = nextSunday($dateMarker);
954 38 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 11 27 38
955 11 return "The Fourth Sunday of Easter";
956 }
957  
958 27 $dateMarker = nextSunday($dateMarker);
959 27 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 18 27
960 9 return "The Fifth Sunday of Easter";
961 }
962  
963 18 $dateMarker = nextSunday($dateMarker);
964 18 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 9 18
965 9 return "The Sixth Sunday of Easter";
966 }
967  
968 9 $dateMarker = nextSunday($dateMarker);
969 9 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 0 9
970 9 return "The Sunday after Ascension Day";
971 }
972  
973 0 confess "There are no further Sundays of Easter for [" . $date->ymd . "].";
974 }
975  
976 =head2 _determineOrdinary
977  
978 Private method that matches the date given at construction against the Sundays in Ordinary time, e.g. Trinity Sunday and following Sundays. Returns a string representation of the name of the Sunday in the lectionary.
979  
980 =cut
981  
982 242 ▶sub _determineOrdinary {
Subroutine _determineOrdinary: called CC=29 SCAR=33.7
983 242 my $date = shift;
984 242 my $pentecost = shift;
985  
986 242 my $trinitySunday = nextSunday($pentecost);
987 242 ▶ if ( $date == $trinitySunday ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $trinitySunday) 9 233 242
988 9 return "Trinity Sunday";
989 }
990  
991 233 my $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-05-25", "%Y-%m-%d" ) );
992 233 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 0 233 233
993 0 return "Ordinary 8";
994 }
995  
996 233 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-06-01", "%Y-%m-%d" ) );
997 233 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 3 230 233
998 3 return "Ordinary 9";
999 }
1000  
1001 230 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-06-08", "%Y-%m-%d" ) );
1002 230 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 6 224 230
1003 6 return "Ordinary 10";
1004 }
1005  
1006 224 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-06-15", "%Y-%m-%d" ) );
1007 224 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 215 224
1008 9 return "Ordinary 11";
1009 }
1010  
1011 215 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-06-22", "%Y-%m-%d" ) );
1012 215 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 206 215
1013 9 return "Ordinary 12";
1014 }
1015  
1016 206 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-06-29", "%Y-%m-%d" ) );
1017 206 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 10 196 206
1018 10 return "Ordinary 13";
1019 }
1020  
1021 196 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-07-06", "%Y-%m-%d" ) );
1022 196 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 187 196
1023 9 return "Ordinary 14";
1024 }
1025  
1026 187 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-07-13", "%Y-%m-%d" ) );
1027 187 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 178 187
1028 9 return "Ordinary 15";
1029 }
1030  
1031 178 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-07-20", "%Y-%m-%d" ) );
1032 178 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 169 178
1033 9 return "Ordinary 16";
1034 }
1035  
1036 169 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-07-27", "%Y-%m-%d" ) );
1037 169 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 160 169
1038 9 return "Ordinary 17";
1039 }
1040  
1041 160 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-08-03", "%Y-%m-%d" ) );
1042 160 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 8 152 160
1043 8 return "Ordinary 18";
1044 }
1045  
1046 152 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-08-10", "%Y-%m-%d" ) );
1047 152 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 143 152
1048 9 return "Ordinary 19";
1049 }
1050  
1051 143 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-08-17", "%Y-%m-%d" ) );
1052 143 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 134 143
1053 9 return "Ordinary 20";
1054 }
1055  
1056 134 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-08-24", "%Y-%m-%d" ) );
1057 134 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 125 134
1058 9 return "Ordinary 21";
1059 }
1060  
1061 125 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-08-31", "%Y-%m-%d" ) );
1062 125 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 116 125
1063 9 return "Ordinary 22";
1064 }
1065  
1066 116 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-09-07", "%Y-%m-%d" ) );
1067 116 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 107 116
1068 9 return "Ordinary 23";
1069 }
1070  
1071 107 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-09-14", "%Y-%m-%d" ) );
1072 107 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 98 107
1073 9 return "Ordinary 24";
1074 }
1075  
1076 98 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-09-21", "%Y-%m-%d" ) );
1077 98 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 89 98
1078 9 return "Ordinary 25";
1079 }
1080  
1081 89 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-09-28", "%Y-%m-%d" ) );
1082 89 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 80 89
1083 9 return "Ordinary 26";
1084 }
1085  
1086 80 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-10-05", "%Y-%m-%d" ) );
1087 80 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 71 80
1088 9 return "Ordinary 27";
1089 }
1090  
1091 71 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-10-12", "%Y-%m-%d" ) );
1092 71 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 62 71
1093 9 return "Ordinary 28";
1094 }
1095  
1096 62 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-10-19", "%Y-%m-%d" ) );
1097 62 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 53 62
1098 9 return "Ordinary 29";
1099 }
1100  
1101 53 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-10-26", "%Y-%m-%d" ) );
1102 53 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 44 53
1103 9 return "Ordinary 30";
1104 }
1105  
1106 44 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-11-02", "%Y-%m-%d" ) );
1107 44 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 6 38 44
1108 6 return "Ordinary 31";
1109 }
1110  
1111 38 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-11-09", "%Y-%m-%d" ) );
1112 38 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 9 29 38
1113 9 return "Ordinary 32";
1114 }
1115  
1116 29 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-11-16", "%Y-%m-%d" ) );
1117 29 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 17 12 29
1118 17 return "Ordinary 33";
1119 }
1120  
1121 12 $dateMarker = closestSunday( Time::Piece->strptime( $pentecost->year . "-11-23", "%Y-%m-%d" ) );
1122 12 ▶ if ( $date == $dateMarker ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $dateMarker) 12 0 12
1123 12 return "Christ the King";
1124 }
1125  
1126 0 confess "There are no further Sundays of Ordinary Time.";
1127 }
1128  
1129 =head2 _determineDay
1130  
1131 Private method that takes the Time::Piece data given at construction and, using other private methods, determines the name of the Feast Day or Sunday in the lectionary. If the date given at construction is a fixed feast, that day will be returned. If the date given is a special feast -- e.g. Easter, Ash Wednesday, etc. -- or a Sunday the name of that day will be returned. If the date isn't a special feast or a Sunday the date represented as a string will be returned as the name with no associated readings.
1132  
1133 =cut
1134  
1135 625 ▶sub _determineDay {
Subroutine _determineDay: called CC=20 SCAR=30.0
1136 625 my $date = shift;
1137 625 my $lectionary = shift;
1138 625 my $includeFeasts = shift;
1139  
1140 625 my $advent = shift;
1141 625 my $easter = shift;
1142  
1143 #Is the date in Advent?
1144 625 ▶ if ( $date == $advent->firstSunday ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($date == $advent->firstSunday) { } 9 616 625
elsif ($date == $advent->secondSunday) { } 9 607 616
elsif ($date == $advent->thirdSunday) { } 9 598 607
elsif ($date == $advent->fourthSunday) { } 9 589 598
1145 return (
1146 9 commonName => "The First Sunday in Advent",
1147 type => 'Sunday',
1148 season => 'Advent'
1149 );
1150 }
1151 elsif ( $date == $advent->secondSunday ) {
1152 return (
1153 9 commonName => "The Second Sunday in Advent",
1154 type => 'Sunday',
1155 season => 'Advent'
1156 );
1157 }
1158 elsif ( $date == $advent->thirdSunday ) {
1159 return (
1160 9 commonName => "The Third Sunday in Advent",
1161 type => 'Sunday',
1162 season => 'Advent'
1163 );
1164 }
1165 elsif ( $date == $advent->fourthSunday ) {
1166 return (
1167 9 commonName => "The Fourth Sunday in Advent",
1168 type => 'Sunday',
1169 season => 'Advent'
1170 );
1171 }
1172  
1173 #Is the date Easter Sunday?
1174 589 ▶ if ( $date == $easter ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $easter) 13 576 589
1175 return (
1176 13 commonName => "Easter Day",
1177 type => 'fixedFeast',
1178 season => 'Easter'
1179 );
1180 }
1181  
1182 #Determine when Ash Wednesday is
1183 576 my $ashWednesday = _determineAshWednesday($easter);
1184 576 ▶ if ( $date == $ashWednesday ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $ashWednesday) 3 573 576
1185 return (
1186 3 commonName => "Ash Wednesday",
1187 type => 'fixedFeast',
1188 season => 'Lent'
1189 );
1190 }
1191  
1192 #Holy Week
1193 573 my $holyWeekDay = _determineHolyWeek( $date, $easter );
1194 573 ▶ if ($holyWeekDay) {
Branch: 1 branch
BranchTrueFalseTotal
if ($holyWeekDay) 23 550 573
1195 return (
1196 23 commonName => $holyWeekDay,
1197 type => 'fixedFeast',
1198 season => 'Lent'
1199 );
1200 }
1201  
1202 #Easter Week
1203 550 my $easterWeekDay = _determineEasterWeek( $date, $easter );
1204 550 ▶ if ($easterWeekDay) {
Branch: 1 branch
BranchTrueFalseTotal
if ($easterWeekDay) 10 540 550
1205 return (
1206 10 commonName => $easterWeekDay,
1207 type => 'fixedFeast',
1208 season => 'Easter'
1209 );
1210 }
1211  
1212 #Ascension is 40 days after Easter
1213 540 my $ascension = _determineAscension($easter);
1214 540 ▶ if ( $date == $ascension ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $ascension) 3 537 540
1215 return (
1216 3 commonName => "Ascension Day",
1217 type => 'fixedFeast',
1218 season => 'Easter'
1219 );
1220 }
1221  
1222 #Pentecost is 50 days after Easter
1223 537 my $pentecost = _determinePentecost($easter);
1224 537 ▶ if ( $date == $pentecost ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date == $pentecost) 12 525 537
1225 return (
1226 12 commonName => "Pentecost",
1227 type => 'fixedFeast',
1228 season => 'Pentecost'
1229 );
1230 }
1231  
1232 #Feast Day Celebrations
1233 525 ▶ if ( $includeFeasts eq 'yes' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($includeFeasts eq "yes") 524 1 525
1234 524 my %feastDay = _determineFeasts( $date, $lectionary );
1235 524 ▶ if ( $feastDay{commonName} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($feastDay{"commonName"}) 70 454 524
1236 return (
1237 commonName => $feastDay{commonName},
1238 type => $feastDay{type},
1239 season => $feastDay{season}
1240 70 );
1241 }
1242 }
1243  
1244 #If the date isn't a Sunday and we've determined it is not a fixed holiday
1245 #then there are no readings for that day.
1246 455 ▶ if ( $date->wday != 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date->wday != 1) 31 424 455
1247 return (
1248 31 commonName => $date->fullday . ', ' . $date->fullmonth . ' ' . $date->mday . ', ' . $date->year,
1249 type => 'noLect',
1250 season => 'NaN'
1251 );
1252 }
1253  
1254 #Sundays of the Liturgical Year
1255 424 ▶ if ( $date < $ashWednesday ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date < $ashWednesday) 80 344 424
1256 80 my %xmasEpiphany = (
1257 commonName => _determineChristmasEpiphany( $date, $advent, $ashWednesday, $lectionary ),
1258 type => 'Sunday'
1259 );
1260  
1261 80 ▶ if ( $xmasEpiphany{commonName} =~ m/Christmas/ig ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xmasEpiphany{'commonName'} =~ /Christmas/giu) { } 12 68 80
1262 12 $xmasEpiphany{season} = 'Christmas';
1263 12 return %xmasEpiphany;
1264 }
1265 else {
1266 68 $xmasEpiphany{season} = 'Epiphany';
1267 68 return %xmasEpiphany;
1268 }
1269 }
1270  
1271 344 ▶ if ( $date < $easter ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date < $easter) 46 298 344
1272 return (
1273 46 commonName => _determineLent( $date, $ashWednesday ),
1274 type => 'Sunday',
1275 season => 'Lent'
1276 );
1277 }
1278  
1279 298 ▶ if ( $date > $easter && $date < $pentecost ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date > $easter and $date < $pentecost) 56 242 298
Condition66%2/3
$date > $easter and $date < $pentecost
!ll&&!rl&&r
024256
MC/DC50%1/2
$date > $easter and $date < $pentecost
$date > $easter $date < $pentecost
Truth table66%2/3
A and B
A= $date > $easterB= $date < $pentecost
ABresult
0X0
100
111
1280 return (
1281 56 commonName => _determineEasterSeason( $date, $easter ),
1282 type => 'Sunday',
1283 season => 'Easter'
1284 );
1285 }
1286  
1287 242 ▶ if ( $date > $pentecost ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($date > $pentecost) 242 0 242
1288 return (
1289 242 commonName => _determineOrdinary( $date, $pentecost ),
1290 type => 'Sunday',
1291 season => 'Ordinary'
1292 );
1293 }
1294 }
1295  
1296 =head1 AUTHOR
1297  
1298 Michael Wayne Arnold, C<< <michael at rnold.info> >>
1299  
1300 =head1 BUGS
1301  
1302 Please report any bugs or feature requests to C<bug-date-lectionary at rt.cpan.org>, or through
1303 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-Lectionary-Day>. I will be notified, and then you'll
1304 automatically be notified of progress on your bug as I make changes.
1305  
1306 =head1 SUPPORT
1307  
1308 You can find documentation for this module with the perldoc command.
1309  
1310 perldoc Date::Lectionary::Day
1311  
1312  
1313 You can also look for information at:
1314  
1315 =over 4
1316  
1317 =item * RT: CPAN's request tracker (report bugs here)
1318  
1319 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Lectionary-Day>
1320  
1321 =item * AnnoCPAN: Annotated CPAN documentation
1322  
1323 L<http://annocpan.org/dist/Date-Lectionary-Day>
1324  
1325 =item * CPAN Ratings
1326  
1327 L<http://cpanratings.perl.org/d/Date-Lectionary-Day>
1328  
1329 =item * Search CPAN
1330  
1331 L<http://search.cpan.org/dist/Date-Lectionary-Day/>
1332  
1333 =back
1334  
1335 =head1 ACKNOWLEDGEMENTS
1336  
1337 Many thanks to my beautiful wife, Jennifer, my amazing daughter, Rosemary, and my sweet son, Oliver. But, above all, SOLI DEO GLORIA!
1338  
1339 =head1 LICENSE
1340  
1341 Copyright 2016-2018 MICHAEL WAYNE ARNOLD
1342  
1343 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1344  
1345 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1346  
1347 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1348  
1349 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1350  
1351  
1352 =cut
1353  
1354 10 __PACKAGE__->meta->make_immutable;
1355  
1356 10 1; # End of Date::Lectionary::Day
↑ Summary Lectionary/Year.pm »