The SLUG Daemon writes:

> You might be fascinated to learn that there is a SLUG meeting next Monday
> evening at 7pm.  As a reminder, SLUG meetings occur on the second Monday
> of each month.  Today is Wednesday; I just wanted to give you plenty of
> advance notice.

Here is the code, in case other chapters find this to be useful.  I
guess I'll run this from a daily cron script.

Just another Perl hacker,

--kevin
-- 
GnuPG ID: B280F24E                     And the madness of the crowd
alumni.unh.edu!kdc                     Is an epileptic fit
                                       -- Tom Waits

#!/usr/bin/perl -w

use strict;
use Date::Calc qw(:all);

  my $MONDAY = 1;
  my $NUM_DAYS_BTWN_MON_WED = 5;

  my ($tyear,$tmonth,$tday) = Today();
  my ($myear,$mmonth,$mday);

  # $mday et al. identify the 2nd Monday in the given month
  die "Nth_Weekday_of_Month_Year problem!\n"
    if (! (($myear,$mmonth,$mday) 
            = Nth_Weekday_of_Month_Year($tyear,$tmonth,$MONDAY,2)));

  my $dd = Delta_Days($tyear,$tmonth,$tday,
                      $myear,$mmonth,$mday);

  if ($dd == $NUM_DAYS_BTWN_MON_WED) {

     open(MAIL, "| /usr/lib/sendmail -oi -oem -t")
       || die "Couldn't open sendmail: $!\n";
     $SIG{PIPE} = 'IGNORE';  # good idea

     print MAIL <<EO_MESSAGE;
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Subject: upcoming SLUG meeting on $mmonth/$mday/$myear



[this is an automatically generated message from the SLUG daemon]


Hello,

You might be fascinated to learn that there is a SLUG meeting next Monday
evening at 7pm.  As a reminder, SLUG meetings occur on the second Monday
of each month.  Today is Wednesday; I just wanted to give you plenty of
advance notice.

Kind regards,

The SLUG Daemon

EO_MESSAGE

  } # end of "if ($dd == $NUM_DAYS_BTWN_MON_WED) {"

__END__

Reply via email to