The Time::Piece object date given at object construction.
=head3 lectionary
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.
=head3 type
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.
=head3 name
The name of the day in the lectionary. For noLect days a String representation of the day is returned as the name.
=head3 alt
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.
=head3 multiLect
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.
=head3 subLects
An ArrayRef of the names of the multiple services that occur on a multiLect day.
=head3 includeFeasts
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.
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.
=cut
has'date'=> (
is=> 'ro',
isa=> 'Time::Piece',
required=> 1,
);
has'type'=> (
is=> 'ro',
isa=> 'DayType',
writer=> '_setType',
init_arg=> undef,
);
has'lectionary'=> (
is=> 'ro',
isa=> 'LectionaryType',
default=> 'acna',
);
has'displayName'=> (
is=> 'ro',
isa=> 'Str',
writer=> '_setDisplayName',
init_arg=> undef,
alias=> 'name',
);
has'altName'=> (
is=> 'ro',
isa=> 'Str',
writer=> '_setAltName',
init_arg=> undef,
alias=> 'alt',
);
has'commonName'=> (
is=> 'ro',
isa=> 'Str',
writer=> '_setCommonName',
init_arg=> undef,
);
has'multiLect'=> (
is=> 'ro',
isa=> 'MultiLect',
writer=> '_setMultiLect',
init_arg=> undef,
);
has'subLects'=> (
is=> 'ro',
isa=> 'ArrayRef',
writer=> '_setSubLects',
init_arg=> undef,
);
has'includeFeasts'=> (
is=> 'ro',
isa=> 'IncludeFeasts',
default=> 'yes',
);
=head2 BUILD
Constructor for the Date::Lectionary object. Takes a Time::Piect object, C<date>, to create the object.
confess "Could not calculate Easter for the year [". $easterYear. "]";
};
}
=head2 _determineFeasts
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.
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.
=cut
sub_buildMoveableDays {
my$date= shift;
my$lectionary= shift;
#Moveable holidays in January
if( $date->mon == 1 ) {
if( $date->mday == 18 && $lectionaryeq 'acna') {
return"Confession of St. Peter";
}
if( $date->mday == 25 && $lectionaryeq 'acna') {
return"Conversion of St. Paul";
}
}
#Moveable holidays in February
elsif( $date->mon == 2 ) {
if( $date->mday == 2 ) {
return"The Presentation of Christ in the Temple";
}
if( $date->mday == 24 && $lectionaryeq 'acna') {
return"St. Matthias";
}
}
#Moveable holidays in March
elsif( $date->mon == 3 ) {
if( $date->mday == 19 && $lectionaryeq 'acna') {
return"St. Joseph";
}
if( $date->mday == 25 ) {
return"The Annunciation";
}
}
#Moveable holidays in April
elsif( $date->mon == 4 ) {
if( $date->mday == 25 && $lectionaryeq 'acna') {
return"St. Mark";
}
}
#Moveable holidays in May
elsif( $date->mon == 5 ) {
if( $date->mday == 1 && $lectionaryeq 'acna') {
return"St. Philip & St. James";
}
if( $date->mday == 31 ) {
return"The Visitation";
}
}
#Moveable holidays in June
elsif( $date->mon == 6 ) {
if( $date->mday == 11 && $lectionaryeq 'acna') {
return"St. Barnabas";
}
if( $date->mday == 24 && $lectionaryeq 'acna') {
return"Nativity of St. John the Baptist";
}
if( $date->mday == 29 && $lectionaryeq 'acna') {
return"St. Peter & St. Paul";
}
}
#Moveable holidays in July
elsif( $date->mon == 7 ) {
if( $date->mday == 22 && $lectionaryeq 'acna') {
return"St. Mary Magdalene";
}
if( $date->mday == 25 && $lectionaryeq 'acna') {
return"St. James";
}
}
#Moveable holidays in August
elsif( $date->mon == 8 ) {
if( $date->mday == 15 && $lectionaryeq 'acna') {
return"St. Mary the Virgin";
}
if( $date->mday == 24 && $lectionaryeq 'acna') {
return"St. Bartholomew";
}
}
#Moveable holidays in September
elsif( $date->mon == 9 ) {
if( $date->mday == 14 ) {
return"Holy Cross Day";
}
if( $date->mday == 21 && $lectionaryeq 'acna') {
return"St. Matthew";
}
if( $date->mday == 29 && $lectionaryeq 'acna') {
return"Holy Michael & All Angels";
}
}
#Moveable holidays in October
elsif( $date->mon == 10 ) {
if( $date->mday == 18 && $lectionaryeq 'acna') {
return"St. Luke";
}
if( $date->mday == 28 && $lectionaryeq 'acna') {
return"St. Simon & St. Jude";
}
}
#Moveable holidays in November
elsif( $date->mon == 11 ) {
if( $date->mday == 30 && $lectionaryeq 'acna') {
return"St. Andrew";
}
}
#Moveable holidays in December
elsif( $date->mon == 12 ) {
if( $date->mday == 21 && $lectionaryeq 'acna') {
return"St. Thomas";
}
if( $date->mday == 26 && $lectionaryeq 'acna') {
return"St. Stephen";
}
if( $date->mday == 27 && $lectionaryeq 'acna') {
return"St. John";
}
if( $date->mday == 28 && $lectionaryeq 'acna') {
return"Holy Innocents";
}
}
else{
confess "Date [". $date->ymd . "] is not a known or valid date.";
}
}
=head2 _buildFixedDays
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.
=cut
sub_buildFixedDays {
my$date= shift;
my$lectionary= shift;
#Fixed holidays in January
if( $date->mon == 1 ) {
if( $date->mday == 1 ) {
return"Holy Name";
}
if( $date->mday == 6 ) {
return"The Epiphany";
}
}
#Fixed holidays in February
elsif( $date->mon == 2 ) {
}
#Fixed holidays in March
elsif( $date->mon == 3 ) {
}
#Fixed holidays in April
elsif( $date->mon == 4 ) {
}
#Fixed holidays in May
elsif( $date->mon == 5 ) {
}
#Fixed holidays in June
elsif( $date->mon == 6 ) {
}
#Fixed holidays in July
elsif( $date->mon == 7 ) {
}
#Fixed holidays in August
elsif( $date->mon == 8 ) {
if( $date->mday == 6 && $lectionaryeq 'acna') {
return"The Transfiguration";
}
}
#Fixed holidays in September
elsif( $date->mon == 9 ) {
}
#Fixed holidays in October
elsif( $date->mon == 10 ) {
}
#Fixed holidays in November
elsif( $date->mon == 11 ) {
if( $date->mday == 1 ) {
return"All Saints' Day";
}
}
#Fixed holidays in December
elsif( $date->mon == 12 ) {
if( $date->mday == 25 ) {
return"Christmas Day";
}
}
else{
confess "Date [". $date->ymd . "] is not a known or valid date.";
}
}
=head2 _determineAshWednesday
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.
=cut
sub_determineAshWednesday {
my$easter= shift;
my$ashWednesday= undef;
try{
my$secondsToSubtract= 46 * ONE_DAY;
$ashWednesday= $easter- $secondsToSubtract;
return$ashWednesday;
}
catch{
confess "Could not calculate Ash Wednesday for Easter [". $easter->ymd . "].";
};
}
=head2 _determineAscension
Private method that takes the Time::Piece date for Easter and determines the date for Ascension. Ascension is forty days (inclusive) after Easter.
=cut
sub_determineAscension {
my$easter= shift;
my$ascension= undef;
try{
my$secondsToAdd= 39 * ONE_DAY;
$ascension= $easter+ $secondsToAdd;
return$ascension;
}
catch{
confess "Could not calculate Ascension for Easter [". $easter->ymd . "].";
};
}
=head2 _determinePentecost
Private method the takes the Time::Piece date for Easter and determines the date for Pentecost. Pentecost is fifty days (inclusive) after Easter.
=cut
sub_determinePentecost {
my$easter= shift;
my$pentecost= undef;
try{
my$secondsToAdd= 49 * ONE_DAY;
$pentecost= $easter+ $secondsToAdd;
return$pentecost;
}
catch{
confess "Could not calculate Pentecost for Easter [". $easter->ymd . "].";
};
}
=head2 _determineHolyWeek
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.
=cut
sub_determineHolyWeek {
my$date= shift;
my$easter= shift;
my$dateMark= $easter- ONE_DAY;
if( $date== $dateMark) {
return"Holy Saturday";
}
$dateMark= $dateMark- ONE_DAY;
if( $date== $dateMark) {
return"Good Friday";
}
$dateMark= $dateMark- ONE_DAY;
if( $date== $dateMark) {
return"Maundy Thursday";
}
$dateMark= $dateMark- ONE_DAY;
if( $date== $dateMark) {
return"Wednesday in Holy Week";
}
$dateMark= $dateMark- ONE_DAY;
if( $date== $dateMark) {
return"Tuesday in Holy Week";
}
$dateMark= $dateMark- ONE_DAY;
if( $date== $dateMark) {
return"Monday in Holy Week";
}
$dateMark= $dateMark- ONE_DAY;
if( $date== $dateMark) {
return"Palm Sunday";
}
returnundef;
}
=head2 _determineEasterWeek
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.
=cut
sub_determineEasterWeek {
my$date= shift;
my$easter= shift;
my$dateMark= $easter+ ONE_DAY;
if( $date== $dateMark) {
return"Monday of Easter Week";
}
$dateMark= $dateMark+ ONE_DAY;
if( $date== $dateMark) {
return"Tuesday of Easter Week";
}
$dateMark= $dateMark+ ONE_DAY;
if( $date== $dateMark) {
return"Wednesday of Easter Week";
}
$dateMark= $dateMark+ ONE_DAY;
if( $date== $dateMark) {
return"Thursday of Easter Week";
}
$dateMark= $dateMark+ ONE_DAY;
if( $date== $dateMark) {
return"Friday of Easter Week";
}
$dateMark= $dateMark+ ONE_DAY;
if( $date== $dateMark) {
return"Saturday of Easter Week";
}
returnundef;
}
=head2 _hasChristmas2
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.
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.
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");
confess "There are no further Sundays of Christmastide or Epiphany.";
}
=head2 _determineLent
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.
=cut
sub_determineLent {
my$date= shift;
my$ashWednesday= shift;
my$dateMarker= nextSunday($ashWednesday);
if( $date== $dateMarker) {
return"The First Sunday in Lent";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Second Sunday in Lent";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Third Sunday in Lent";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Fourth Sunday in Lent";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Fifth Sunday in Lent";
}
confess "There are no further Sundays in Lent";
}
=head2 _determineEasterSeason
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.
=cut
sub_determineEasterSeason {
my$date= shift;
my$easter= shift;
my$dateMarker= nextSunday($easter);
if( $date== $dateMarker) {
return"The Second Sunday of Easter";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Third Sunday of Easter";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Fourth Sunday of Easter";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Fifth Sunday of Easter";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Sixth Sunday of Easter";
}
$dateMarker= nextSunday($dateMarker);
if( $date== $dateMarker) {
return"The Sunday after Ascension Day";
}
confess "There are no further Sundays of Easter for [". $date->ymd . "].";
}
=head2 _determineOrdinary
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.
confess "There are no further Sundays of Ordinary Time.";
}
=head2 _determineDay
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.
=cut
sub_determineDay {
my$date= shift;
my$lectionary= shift;
my$includeFeasts= shift;
my$advent= shift;
my$easter= shift;
#Is the date in Advent?
if( $date== $advent->firstSunday ) {
return( commonName=> "The First Sunday in Advent", type=> 'Sunday');
}
elsif( $date== $advent->secondSunday ) {
return(
commonName=> "The Second Sunday in Advent",
type=> 'Sunday'
);
}
elsif( $date== $advent->thirdSunday ) {
return( commonName=> "The Third Sunday in Advent", type=> 'Sunday');
Many thanks to my beautiful wife, Jennifer, and my amazing daughter, Rosemary. But, above all, SOLI DEO GLORIA!
=head1 LICENSE
Copyright 2016-2018 MICHAEL WAYNE ARNOLD
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
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.
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.
=cut
__PACKAGE__->meta->make_immutable;
1; # End of Date::Lectionary::Day
Keyboard Shortcuts
Global
s
Focus search bar
?
Bring up this help dialog
GitHub
gp
Go to pull requests
gi
go to github issues (only if github is preferred repository)