say $dailyNewReading->readings->{morning}->{2}; #Second lesson for morning prayer, Matthew 5
=head1 DESCRIPTION
Date::Lectionary::Daily takes a Time::Piece date and returns readings for morning and evening prayer for that date.
=head2 CONSTRUCTOR ATTRIBUTES
=head3 date
The Time::Piece object date of the day you woudl like the lessons for.
=head3 lectionary
One of two choices `acna-sec` for the new secular calendar based ACNA daily lectionary or `acna-xian` for the previous liturgically-based ACNA daily lectionary.
If lectionary is not given at construction, the ACNA secular daily lectionary — `acna-sec` — will be used.
=head2 ATTRIBUTES
=head3 week
The name of the liturgical week in the lectionary; e.g. `The First Sunday in Lent`.
=head3 day
The name of the day of the week; e.g. `Sunday`.
=head3 tradition
Presently only returns `acna`. Future version of the module may include daily lectionary from other traditions.
=head3 type
Returns `secular` for daily lectionaries based on the secular/civil calendar and `liturgical` for daily lectionaries based on the liturgical calendar.
=head3 readings
A hasref of the readings for the day.
=cut
enum 'DailyLectionary', [qw(acna-sec acna-xian)];
enum 'Tradition', [qw(acna)];
enum 'LectionaryType', [qw(secular liturgical)];
noMoose::Util::TypeConstraints;
=head1 SUBROUTINES/METHODS
=cut
has'date'=> (
is=> 'ro',
isa=> 'Time::Piece',
required=> 1,
);
has'week'=> (
is=> 'ro',
isa=> 'Str',
writer=> '_setWeek',
init_arg=> undef,
);
has'day'=> (
is=> 'ro',
isa=> 'Str',
writer=> '_setDay',
init_arg=> undef,
);
has'lectionary'=> (
is=> 'ro',
isa=> 'DailyLectionary',
default=> 'acna-sec',
);
has'tradition'=> (
is=> 'ro',
isa=> 'Tradition',
writer=> '_setTradition',
init_arg=> undef,
);
has'type'=> (
is=> 'ro',
isa=> 'LectionaryType',
writer=> '_setType',
init_arg=> undef,
);
has'readings'=> (
is=> 'ro',
isa=> 'HashRef',
writer=> '_setReadings',
init_arg=> undef,
);
=head2 BUILD
Constructor for the Date::Lectionary object. Takes a Time::Piect object, C<date>, to create the object.
Private method to determine if the daily lectionary follows the secular calendar or the liturgical calendar.
=cut
sub_buildType {
my$lectionary= shift;
if( $lectionaryeq 'acna-xian') {
return'liturgical';
}
if( $lectionaryeq 'acna-sec') {
return'secular';
}
returnundef;
}
=head2 _buildTradition
Private method to determine the Sunday lectionary tradition of the daily lectionary selected. Used to determine the liturgical week the day falls within.
carp "Could not compile the XPath Expression for $searchDate in the $lectionary lectionary.";
};
if( $lectDB->exists($fixed_xpath) ) {
return1;
}
return0;
}
=head2 _buildReadingsLiturgical
Private method that returns an ArrayRef of strings for the lectionary readings associated with the date according to the liturgical calendar.
=cut
sub_buildReadingsLiturgical {
my$weekName= shift;
my$weekDay= shift;
my$lectionary= shift;
my$readings= _parseLectDB($lectionary);
my$morn1_xpath;
my$morn2_xpath;
my$eve1_xpath;
my$eve2_xpath;
try{
$morn1_xpath= XML::LibXML::XPathExpression->new("/daily-lectionary/week[\@name=\"$weekName\"]/day[\@name=\"$weekDay\"]/lesson[\@service=\"morning\" and \@order=\"1\"]");
$morn2_xpath= XML::LibXML::XPathExpression->new("/daily-lectionary/week[\@name=\"$weekName\"]/day[\@name=\"$weekDay\"]/lesson[\@service=\"morning\" and \@order=\"2\"]");
$eve1_xpath= XML::LibXML::XPathExpression->new("/daily-lectionary/week[\@name=\"$weekName\"]/day[\@name=\"$weekDay\"]/lesson[\@service=\"evening\" and \@order=\"1\"]");
$eve2_xpath= XML::LibXML::XPathExpression->new("/daily-lectionary/week[\@name=\"$weekName\"]/day[\@name=\"$weekDay\"]/lesson[\@service=\"evening\" and \@order=\"2\"]");
}
catch{
carp "Could not compile the XPath Expression for $weekDay in $weekName in the $lectionary lectionary.";
Many thanks to my beautiful wife, Jennifer, my amazing daughter, Rosemary, and my sweet son, Oliver. But, above all, SOLI DEO GLORIA!
=head1 LICENSE BSD-2-Clause
Copyright 2017-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::Daily
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)