| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 #!/usr/local/bin/perl 2 3 # 4 # Produce Yahrzeit Letters 5 # 6 7 open (STDOUT, ">/tmp/summary"); 8 require "getopts.pl"; 9 require "fmtsub"; 10 $seq="aa01"; 11 12 @hebrew_months= ("Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishri", 13 "Heshvan","Kislev","Teveth","Shevat","Adar I","Adar II"); 14 foreach (@hebrew_months) { 15 push (@hmos,"\L$_"); 16 } 17 18 19 $month = shift (@ARGV); 20 foreach (@hmos) { 21 $mo++; 22 if ("\L$month" eq substr($_,0,length($month))) { 23 $heb_month=$hebrew_months[$mo-1]; 24 $mno=$mo; 25 last; 26 } 27 } 28 print "processing month #$mno $month\n"; 29 unless ($mno) { 30 print "Bad paramater : $month\n"; 31 exit; 32 } 33 34 while (<DATA>) { 35 push (@tmpl1,$_); 36 } 37 38 39 while (<>) { 40 if (/:end:/) { 41 if($have_data) { 42 &fmt("",\@mydata); 43 $yy=0; 44 ($yd,$ym)=split(/[ \t]+/,$key{"yahrhebdate"},2); 45 if($ym =~ /\s*(\d+)$/) { $yy =$1; } 46 $ym =~ s/\s*(\d+)$//; 47 48 $tmo=$mo=0; 49 foreach (@hmos) { 50 $mo++; 51 if ("\L$ym" eq substr($_,0,length($ym))) { 52 $tmo=$mo; 53 last; 54 } 55 } 56 if ($tmo) { 57 if (! $yy && ( ($tmo == 12 && $ym eq "Adar") #ambiguous ADAR 58 || (($tmo == 8 || $tmo == 9) && ($yd == 30)))) { 59 print "Ambiguous date: $yd $ym for $key{membername}\n"; 60 } else { 61 $yy = $yy ? $yy : "5759"; 62 if ( $tmo == $mno ) { 63 if ($key{memstatus} =~ /deceased/i) { 64 next; 65 } 66 ($engdate,$shab)=`test.cl "( $tmo $yd $yy )"`; 67 chop($engdate); 68 chop($shab); 69 $key{yahrengdate}=$engdate; 70 $key{yahrshab}= $shab; 71 $t=$key{relation}; 72 $key{relation}= "\L$t"; 73 $relationname = $key{relationname}; 74 $relation = $key{relation}; 75 $relation = "\u$relation"; 76 $membername = $key{membername}; 77 $hebd = $key{yahrhebdate}; 78 $engd = $key{yahrengdate}; 79 $engd =~ s/,.*//; 80 $key{var1}=1; 81 if ($shab =~ /NIL/) { 82 $shab = "Yom Tov"; 83 $key{yahrshab}= $shab; 84 $key{var1}=0; 85 if ( $tmo == 7 ) { 86 $key{note1} = "At your request a `kail male rachamim' prayer may be recited on the shabbos before Yom Kippur."; } 87 elsif ( $tmo == 1 ) { 88 $key{note1} = "At your request a `kail male rachamim' prayer may be recited on the shabbos before the start of the month of Nissan." ; } 89 } 90 $shab =~ s/Shabbos //; 91 $shab =~ s/Parashas //; 92 &form_letter; 93 write; 94 } 95 } 96 } else { 97 print STDERR "Unrecognized month $ym for $key{membername}\n"; 98 } 99 $have_data=0; 100 @mydata = (); 101 next; 102 } 103 } elsif (/:begin:/) { next; 104 } else { 105 push (@mydata,$_); 106 $have_data=1; 107 } 108 } 109 110 sub form_letter { 111 $file="/tmp/yi_".$seq++; 112 @data=(); 113 while (($key,$data) = each %key) { 114 push(@data,":$key: $data\n"); 115 } 116 @tmpl=@tmpl1; 117 open (OUT,">$file.dat") || die "opening $file.dat"; 118 print OUT @data; 119 close OUT; 120 system("fmt -o $file.t $file.dat"); 121 system("nroff -Tlp -mm $file.t > $file.lst"); 122 unlink ("$file.t"); 123 unlink ("$file.dat"); 124 system ("mv $file.t.ps $file.ps"); 125 # system ("mylp $file.ps"); 126 # unlink "$file.ps"; 127 } 128 129 130 format STDOUT_TOP = 131 132 @<<<<<<<<<<<<<<<<<<<<<<<<<<<< Yahrzeits for @<<<<<<<<<<<<< 133 `date +'%B %e, %Y`,$heb_month 134 135 Name Relation Person observing Dates Shabbos 136 ================================================================================================================ 137 138 . 139 140 format STDOUT = 141 @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<@<<<<<<<<<<<<< 142 $relationname, $relation, $membername, $hebd, $engd,$shab 143 144 .
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |