| 1 | package DateTime::Event::Jewish::Parshah; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | DateTime::Event::Jewish::Parshah - Calculate leyning for next | ||||||||||||||||||||||||||||
| 6 | shabbat | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | use DateTime::Event::Jewish::Parshah qw(parshah); | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | my $parshah = parshah(DateTime->today, $israel); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | Returns either a parshah name or a yom tov name for the Shabbat | ||||||||||||||||||||||||||||
| 17 | after the date supplied. The optional I<israel> flag specifies | ||||||||||||||||||||||||||||
| 18 | whether to calculate the leyning for Israel or for the diaspora. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =cut | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 7 | ▶ | use DateTime; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 7 | ▶ | use DateTime::Duration; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 7 | ▶ | use DateTime::Calendar::Hebrew; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 7 | ▶ | use DateTime::Event::Jewish::Yomtov qw(@festival); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 7 | ▶ | use DateTime::Event::Jewish::Sedrah qw(@sedrah); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 7 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | 7 | ▶ | use vars qw(@EXPORT_OK); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 7 | @EXPORT_OK = qw(nextShabbat parshah); | |||||||||||||||||||||||||||
| 33 | 7 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 7 | our %YomTovMap; | |||||||||||||||||||||||||||
| 36 | 7 | our %IsraelYomTovMap; | |||||||||||||||||||||||||||
| 37 | 7 | our %YomTovYear; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head3 _initYomTov($year) | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | Internal function that initialises the yom tov table for the | ||||||||||||||||||||||||||||
| 42 | year in question. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =cut | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 1746 | ▶ | sub _initYomTov { | ||||||||||||||||||||||||||
|
Subroutine
_initYomTov: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 47 | 1746 | my $year = shift; | |||||||||||||||||||||||||||
| 48 | 1746 | ▶ | return if $YomTovYear{$year}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 227 | my $f = DateTime::Calendar::Hebrew->today; | |||||||||||||||||||||||||||
| 50 | 227 | foreach my $yt (@festival) | |||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||
| 52 | 4994 | my ($name, $day, $month, $diaspora) = @$yt; | |||||||||||||||||||||||||||
| 53 | 4994 | $f->set(year=>$year, month=>$month, day=>$day); | |||||||||||||||||||||||||||
| 54 | 4994 | my $fDays = $f->{rd_days}; | |||||||||||||||||||||||||||
| 55 | 4994 | $YomTovMap{$fDays} = $name; | |||||||||||||||||||||||||||
| 56 | 4994 | ▶ | $IsraelYomTovMap{$fDays} = $name unless $diaspora; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 227 | $YomTovYear{$year} = 1; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | # (C) Raphael Mankin 2009 | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # The algorithm for calculating the weekly parshah is taken | ||||||||||||||||||||||||||||
| 66 | # from http://individual.utoronto.ca/kalendis/hebrew/parshah.htm | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head3 nextShabbat($date) | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | Returns the next Shabbat which is strictly after $date. The | ||||||||||||||||||||||||||||
| 71 | returned object is a Hewbrew date. | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | $date is some sort of DateTime object; it does not matter which. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =cut | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 1164 | ▶ | sub nextShabbat { | ||||||||||||||||||||||||||
|
Subroutine
nextShabbat: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | 1164 | my $date = DateTime->from_object(object=>shift)->add(days=>1); | |||||||||||||||||||||||||||
| 79 | 1164 | ▶ | while ($date->day_of_week != 6) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 2329 | $date->add(days=>1); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | 1164 | return DateTime::Calendar::Hebrew->from_object(object=>$date); | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =head3 parshah($date ,[$israel]) | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | Returns the parshah name or a yomtov name for the Shabbat | ||||||||||||||||||||||||||||
| 88 | strictly after $date. | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | $date is some sort of DateTime object; it does not matter which. | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | $israel is an optional flag to indicate that we should use the | ||||||||||||||||||||||||||||
| 93 | logic for Israel rather than the Diaspora. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | See http://individual.utoronto.ca/kalendis/hebrew/parshah.htm for | ||||||||||||||||||||||||||||
| 96 | the logic of this code. | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =cut | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 582 | ▶ | sub parshah { | ||||||||||||||||||||||||||
|
Subroutine
parshah: called CC=35 SCAR=35.8
Pod
documented
| |||||||||||||||||||||||||||||
| 101 | 582 | my $today = shift; | |||||||||||||||||||||||||||
| 102 | 582 | ▶ | my $israel = shift || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 582 | my $targetShabbat = nextShabbat($today); | |||||||||||||||||||||||||||
| 105 | 582 | my $thisYear = $targetShabbat->year(); | |||||||||||||||||||||||||||
| 106 | 582 | _initYomTov($thisYear-1); | |||||||||||||||||||||||||||
| 107 | 582 | _initYomTov($thisYear); | |||||||||||||||||||||||||||
| 108 | 582 | _initYomTov($thisYear+1); | |||||||||||||||||||||||||||
| 109 | 582 | ▶ | if ($israel) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 291 | ▶ | if (exists $IsraelYomTovMap{$targetShabbat->{rd_days}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 0 | return $IsraelYomTovMap{$targetShabbat->{rd_days}}; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | } else { | ||||||||||||||||||||||||||||
| 114 | 291 | ▶ | if (exists $YomTovMap{$targetShabbat->{rd_days}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 0 | return $YomTovMap{$targetShabbat->{rd_days}}; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | 582 | my $thisMonth = $targetShabbat->month(); | |||||||||||||||||||||||||||
| 119 | 582 | my $thisDay = $targetShabbat->day(); | |||||||||||||||||||||||||||
| 120 | # Get the date of last Simchat Torah, bearing in mind that | ||||||||||||||||||||||||||||
| 121 | # the year begins in Nissan. | ||||||||||||||||||||||||||||
| 122 | 582 | ▶ | my $simchatTorah = | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$thisMonth == 7 and $thisDay < 23 - $israel
MC/DC0%0/2
$thisMonth == 7 and $thisDay < 23 - $israel
$thisMonth == 7
$thisDay < 23 - $israel
Truth table33%1/3
A and B
A= $thisMonth == 7B= $thisDay < 23 - $israel
| |||||||||||||||||||||||||||||
| 123 | DateTime::Calendar::Hebrew->new(month=>7, | ||||||||||||||||||||||||||||
| 124 | day=>23-$israel, | ||||||||||||||||||||||||||||
| 125 | year=>($thisMonth==7 && $thisDay<23-$israel )? $thisYear-1: $thisYear); | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # The next few dates only matter if we are in the right part of the year. | ||||||||||||||||||||||||||||
| 128 | # Otherwise, the dates are not used and it is of no | ||||||||||||||||||||||||||||
| 129 | # consequence which year we calculate. The calculation is | ||||||||||||||||||||||||||||
| 130 | # relative to 'workingShabbat', not relative to | ||||||||||||||||||||||||||||
| 131 | # 'targetShabbat'. | ||||||||||||||||||||||||||||
| 132 | # | ||||||||||||||||||||||||||||
| 133 | # The date of Pesach | ||||||||||||||||||||||||||||
| 134 | 582 | ▶ | my $pesach = DateTime::Calendar::Hebrew->new(month=>1, day=>15, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | year=>($thisMonth==7 ? $thisYear-1: $thisYear)); | ||||||||||||||||||||||||||||
| 136 | # The date of 9 Av | ||||||||||||||||||||||||||||
| 137 | 582 | ▶ | my $tishaBAv = DateTime::Calendar::Hebrew->new(month=>5, day=>9, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | year=>($thisMonth==7 ? $thisYear-1: $thisYear) ); | ||||||||||||||||||||||||||||
| 139 | # The date of RoshHashanah | ||||||||||||||||||||||||||||
| 140 | 582 | ▶ | my $RoshHashanah= DateTime::Calendar::Hebrew->new(month=>7, day=>1, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | year=>($thisMonth==7 ? $thisYear : $thisYear+1)); | ||||||||||||||||||||||||||||
| 142 | 582 | my $workingShabbat = | |||||||||||||||||||||||||||
| 143 | nextShabbat($simchatTorah)->subtract_duration(DateTime::Duration->new(days=>7)); | ||||||||||||||||||||||||||||
| 144 | 582 | my $startDay = $workingShabbat->{rd_days}; | |||||||||||||||||||||||||||
| 145 | 582 | my $endDay = $targetShabbat->{rd_days}; | |||||||||||||||||||||||||||
| 146 | 582 | my $parshahNumber = int(($endDay-$startDay)/7); | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | #print "Next Shabbat: " , $targetShabbat->ymd, "\n"; | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 582 | ▶ | if ($parshahNumber < 22) { # No special Shabbattot | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | return $sedrah[$parshahNumber]; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | # From week 22 onwards there are special cases | ||||||||||||||||||||||||||||
| 156 | 582 | $parshahNumber = 21; | |||||||||||||||||||||||||||
| 157 | 582 | $workingShabbat->add_duration(DateTime::Duration->new(days=>21*7)); | |||||||||||||||||||||||||||
| 158 | 582 | my $leapYear = DateTime::Calendar::Hebrew::_leap_year($simchatTorah->year); | |||||||||||||||||||||||||||
| 159 | 582 | my $wDayPesach = $pesach->day_of_week; | |||||||||||||||||||||||||||
| 160 | 582 | my $combined = 0; | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | #print "leap year: $leapYear\tPesach $wDayPesach\n"; | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | LOOP: | ||||||||||||||||||||||||||||
| 166 | 582 | ▶ | while ($workingShabbat < $targetShabbat) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 3398 | $workingShabbat->add_duration(DateTime::Duration->new(days=> 7)); | |||||||||||||||||||||||||||
| 168 | # If the Shabbat in question is yom tov or chol hamoed | ||||||||||||||||||||||||||||
| 169 | # it does not count towards the parshah count. | ||||||||||||||||||||||||||||
| 170 | 3398 | ▶ | if ($israel && exists $IsraelYomTovMap{$workingShabbat->{rd_days}}) {next;} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$israel and exists $DateTime::Event::Jewish::Parshah::IsraelYomTovMap{$workingShabbat->{"rd_days"}}
MC/DC100%2/2
$israel and exists $DateTime::Event::Jewish::Parshah::IsraelYomTovMap{$workingShabbat->{"rd_days"}}
$israel
exists $DateTime::Event::Jewish::Parshah::IsraelYomTovMap{$workingShabbat->{"rd_days"}}
Truth table100%3/3
A and B
A= $israelB= exists $DateTime::Event::Jewish::Parshah::IsraelYomTovMap{$workingShabbat->{"rd_days"}}
| |||||||||||||||||||||||||||||
| 171 | 3338 | ▶ | if (!$israel && exists $YomTovMap{$workingShabbat->{rd_days}}) {next;} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $israel and exists $DateTime::Event::Jewish::Parshah::YomTovMap{$workingShabbat->{"rd_days"}}
MC/DC100%2/2
not $israel and exists $DateTime::Event::Jewish::Parshah::YomTovMap{$workingShabbat->{"rd_days"}}
not $israel
exists $DateTime::Event::Jewish::Parshah::YomTovMap{$workingShabbat->{"rd_days"}}
Truth table100%3/3
not(A) and B
A= not $israelB= exists $DateTime::Event::Jewish::Parshah::YomTovMap{$workingShabbat->{"rd_days"}}
| |||||||||||||||||||||||||||||
| 172 | 3246 | my $workingDays = $workingShabbat->{rd_days}; | |||||||||||||||||||||||||||
| 173 | 3246 | ▶ | $parshahNumber++ if ($combined); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | 3246 | $combined = 0; | |||||||||||||||||||||||||||
| 175 | 3246 | $parshahNumber++; | |||||||||||||||||||||||||||
| 176 | 3246 | ▶ | if($parshahNumber==22) { #Vayakhel | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | # Combine Vayakhel/Pekudei if there are fewer than 4 | ||||||||||||||||||||||||||||
| 178 | # Shabbatot *before* the first day of Pesach | ||||||||||||||||||||||||||||
| 179 | 582 | my $pesachDays = $pesach->{rd_days}; | |||||||||||||||||||||||||||
| 180 | 582 | ▶ | $combined =1 if ($pesachDays - $workingDays < 22); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 582 | next LOOP; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | 2664 | ▶ | if($parshahNumber ==27 || # Tazria | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$parshahNumber == 27 or $parshahNumber == 29
MC/DC100%2/2
$parshahNumber == 27 or $parshahNumber == 29
$parshahNumber == 27
$parshahNumber == 29
Truth table100%3/3
A or B
A= $parshahNumber == 27B= $parshahNumber == 29
| |||||||||||||||||||||||||||||
| 184 | $parshahNumber ==29) { # Acharei Mot | ||||||||||||||||||||||||||||
| 185 | 240 | ▶ | $combined = 1 if (!$leapYear); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 240 | next LOOP; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | 2424 | ▶ | if($parshahNumber == 32) { # Behar | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 120 | ▶ | if ($israel) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | # In Israel we need to change the condition to | ||||||||||||||||||||||||||||
| 191 | # not a leap year and Pesach not on Shabbat. | ||||||||||||||||||||||||||||
| 192 | # Ths can only happen in a 354 day year that | ||||||||||||||||||||||||||||
| 193 | # started on a thursday. | ||||||||||||||||||||||||||||
| 194 | 60 | ▶ | $combined = 1 if (!$leapYear && $wDayPesach != 7); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $leapYear and $wDayPesach != 7
MC/DC100%2/2
not $leapYear and $wDayPesach != 7
not $leapYear
$wDayPesach != 7
Truth table100%3/3
not(A) and B
A= not $leapYearB= $wDayPesach != 7
| |||||||||||||||||||||||||||||
| 195 | } else { | ||||||||||||||||||||||||||||
| 196 | # if Pesach falls on Shabbat then Pesach8 is | ||||||||||||||||||||||||||||
| 197 | # also on Shabbat. This is not relevant in | ||||||||||||||||||||||||||||
| 198 | # Israel. | ||||||||||||||||||||||||||||
| 199 | 60 | ▶ | $combined = 1 if (!$leapYear); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | 120 | next LOOP; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | 2304 | ▶ | if($parshahNumber == 39) { # Chukat | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | # If Pesach falls on Thursday then Shavuot2 is Shabbat | ||||||||||||||||||||||||||||
| 205 | # In Israel never combine because Shavuot can never be Shabbat | ||||||||||||||||||||||||||||
| 206 | 120 | ▶ | $combined = 1 if( $wDayPesach == 5 && !$israel); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$wDayPesach == 5 and not $israel
MC/DC100%2/2
$wDayPesach == 5 and not $israel
$wDayPesach == 5
not $israel
Truth table100%3/3
A and not(B)
A= $wDayPesach == 5B= not $israel
| |||||||||||||||||||||||||||||
| 207 | 120 | next LOOP; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | 2184 | ▶ | if($parshahNumber == 42) { # Mattot | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | # Devraim is always read on the Shabbat before | ||||||||||||||||||||||||||||
| 211 | # Tisha B'Av. If 9 Av falls on Shabbat, then | ||||||||||||||||||||||||||||
| 212 | # we read Devarim actually on 9 Av. | ||||||||||||||||||||||||||||
| 213 | 120 | my $avDays = $tishaBAv->{rd_days}; | |||||||||||||||||||||||||||
| 214 | 120 | ▶ | $combined = 1 if (($avDays - $workingDays) < 14); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | 120 | next LOOP; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | 2064 | ▶ | if(51 == $parshahNumber ) { # Nitzavim | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | # Is there a Shabbat between YC and Succot? | ||||||||||||||||||||||||||||
| 219 | 60 | my $roshDays = $RoshHashanah->{rd_days}; | |||||||||||||||||||||||||||
| 220 | 60 | ▶ | $combined = 1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | if (($roshDays - $workingDays) > 3); | ||||||||||||||||||||||||||||
| 222 | 60 | next LOOP; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 582 | my $parshah = $sedrah[$parshahNumber]; | |||||||||||||||||||||||||||
| 227 | 582 | ▶ | $parshah .= "/" . $sedrah[$parshahNumber+1] if ($combined); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 582 | return $parshah; | |||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | =head1 BUGS | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | DateTime::Calendar::Hebrew is not a sub-class of DateTime. It | ||||||||||||||||||||||||||||
| 236 | does not implement the all functionality of DateTime, and where it | ||||||||||||||||||||||||||||
| 237 | does implement it, it uses different names and interfaces. | ||||||||||||||||||||||||||||
| 238 | In particular, none of the arithmetic works. | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =cut | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 7 | 1; | |||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | Raphael Mankin, C<< <rapmankin at cpan.org> >> | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | =head1 BUGS | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | Please report any bugs or feature requests to C<bug-datetime-event-jewish at rt.cpan.org>, or through | ||||||||||||||||||||||||||||
| 251 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DateTime-Event-Jewish>. I will be notified, and then you'll | ||||||||||||||||||||||||||||
| 252 | automatically be notified of progress on your bug as I make changes. | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | perldoc DateTime::Event::Jewish | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | You can also look for information at: | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =over 4 | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTime-Event-Jewish> | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | L<http://annocpan.org/dist/DateTime-Event-Jewish> | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | L<http://cpanratings.perl.org/d/DateTime-Event-Jewish> | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =item * Search CPAN | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | L<http://search.cpan.org/dist/DateTime-Event-Jewish/> | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =back | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | Copyright 2010 Raphael Mankin. | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 295 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||
| 296 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =cut | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 7 | 1; # End of DateTime::Event::Parshah | |||||||||||||||||||||||||||