[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/yahrzeit/old/ -> yahrlst (source)

   1  #!/usr/local/bin/perl
   2  
   3  #
   4  #  Produce Yahrzeit List
   5  #  
   6  
   7  require "getopts.pl";
   8  require "fmtsub";
   9  $seq="aa01";
  10  $= = 42;
  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  
  30  while (<DATA>) {
  31      push (@tmpl1,$_);
  32  } 
  33  
  34  
  35  while (<>) {
  36      last if /^###/;
  37      if (/:end:/) {
  38          if($have_data) { 
  39              &fmt("",\@mydata);
  40              $yy=0;
  41              ($yd,$ym)=split(/[ \t]+/,$key{"yahrhebdate"},2);
  42  #            print "yd: $yd  ym: $ym\n";
  43  
  44              if($ym =~ /\s*(\d+)$/) { $yy =$1; }
  45              $ym =~ s/\s*(\d+)$//;
  46  #            print "ym: |$ym|   yy: $yy\n";
  47              $tmo=$mo=0;
  48              foreach (@hmos) {
  49                  $mo++;
  50                  if ("\L$ym" eq substr($_,0,length($ym))) {
  51                      $tmo=$mo;
  52  #                    print "tmo: $tmo\n";
  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 ( 1 ) {
  63                          ($engdate,$shab)=`test.cl "( $tmo $yd $yy )"`;
  64                          chop($engdate);
  65                          chop($shab);
  66                          $key{yahrengdate}=$engdate;
  67                          $key{yahrshab}= $shab;
  68                          $t=$key{relation};
  69                          $key{relation}= "\L$t";
  70                          $relationname = $key{relationname};
  71                          $relation = $key{relation};
  72                          $relation = "\u$relation";
  73                          $membername = $key{membername};
  74                          $hebd = $key{yahrhebdate};
  75                          $engd = $key{yahrengdate};
  76                          $engd =~ s/,.*//;
  77                          $shab =~ s/Shabbos //;
  78                          $shab =~ s/Parashas //;
  79                          write;
  80                      } 
  81                  } 
  82              } else {
  83                  print STDERR "Unrecognized month $ym for $key{membername}\n";
  84              }
  85              $have_data=0;
  86              @mydata = ();
  87              next;
  88          }
  89      } elsif (/:begin:/) { next; 
  90      } else {
  91          push (@mydata,$_);
  92          $have_data=1;
  93      }
  94  }
  95  
  96  
  97  format STDOUT_TOP =
  98  
  99  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<          Yahrzeits for @<<<<<<<<<<<<<   
 100  `date +'%B %e, %Y`,$heb_month
 101  
 102  Name                             Relation        Person observing               Dates                 Shabbos
 103  ================================================================================================================
 104  
 105  .
 106  
 107  format STDOUT =
 108  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<@<<<<<<<<<<<<<
 109  $relationname,     $relation,          $membername,      $hebd, $engd,$shab
 110  
 111  .


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7