#!/usr/local/bin/perl # # Produce Yahrzeit List # require "getopts.pl"; require "fmtsub"; $seq="aa01"; $= = 42; @hebrew_months= ("Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishri", "Heshvan","Kislev","Teveth","Shevat","Adar I","Adar II"); foreach (@hebrew_months) { push (@hmos,"\L$_"); } $month = shift (@ARGV); foreach (@hmos) { $mo++; if ("\L$month" eq substr($_,0,length($month))) { $heb_month=$hebrew_months[$mo-1]; $mno=$mo; last; } } #print "processing month #$mno $month\n"; while () { push (@tmpl1,$_); } while (<>) { last if /^###/; if (/:end:/) { if($have_data) { &fmt("",\@mydata); $yy=0; ($yd,$ym)=split(/[ \t]+/,$key{"yahrhebdate"},2); # print "yd: $yd ym: $ym\n"; if($ym =~ /\s*(\d+)$/) { $yy =$1; } $ym =~ s/\s*(\d+)$//; # print "ym: |$ym| yy: $yy\n"; $tmo=$mo=0; foreach (@hmos) { $mo++; if ("\L$ym" eq substr($_,0,length($ym))) { $tmo=$mo; # print "tmo: $tmo\n"; last; } } if ($tmo) { if (! $yy && ( ($tmo == 12 && $ym eq "Adar") #ambiguous ADAR || (($tmo == 8 || $tmo == 9) && ($yd == 30)))) { print "Ambiguous date: $yd $ym for $key{membername}\n"; } else { $yy = $yy ? $yy : "5759"; if ( 1 ) { ($engdate,$shab)=`test.cl "( $tmo $yd $yy )"`; chop($engdate); chop($shab); $key{yahrengdate}=$engdate; $key{yahrshab}= $shab; $t=$key{relation}; $key{relation}= "\L$t"; $relationname = $key{relationname}; $relation = $key{relation}; $relation = "\u$relation"; $membername = $key{membername}; $hebd = $key{yahrhebdate}; $engd = $key{yahrengdate}; $engd =~ s/,.*//; $shab =~ s/Shabbos //; $shab =~ s/Parashas //; write; } } } else { print STDERR "Unrecognized month $ym for $key{membername}\n"; } $have_data=0; @mydata = (); next; } } elsif (/:begin:/) { next; } else { push (@mydata,$_); $have_data=1; } } format STDOUT_TOP = @<<<<<<<<<<<<<<<<<<<<<<<<<<<< Yahrzeits for @<<<<<<<<<<<<< `date +'%B %e, %Y`,$heb_month Name Relation Person observing Dates Shabbos ================================================================================================================ . format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<@<<<<<<<<<<<<< $relationname, $relation, $membername, $hebd, $engd,$shab .