Phoenix.pm: Thursday Meeting Automated Pre-Announcement

Scott Walters scott at illogics.org
Tue Feb 24 15:50:26 CST 2004


"Cool" isn't the first word that comes to mind. I guess I'd better fix the bugs
before I have it mail the list directly. So far I've just forwarded the messages
and lazily not looked at them.

I shouldn't be trying to work on the dates directly myself, but I've actually
never worked with dates before! Amazing, I know. Atleast nothing more complex
than grouping by month and recording and logging. I've seen ugly code using Date::Manip.
What is the preferred method for doing this? This runs from cron, since you're curious ;)

-scott

#!/usr/bin/perl

use Mail::Sendmail;

                   #  0    1    2     3     4    5     6     7
               my  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) =
                                                            gmtime(time);

# print "debug: mday: $mday wday: $wday\n";

if(($mday >= 1 and $mday <= 7) or
   ($mday >= 21 and $mday <= 27)
)  {
  # first week or third week ranges for monday - add offsets for other days
  if($wday == 2) {  
     # 2 == tuesday
     Mail::Sendmail::sendmail(
       # To => 'phoenix-pm-list at happyfunball.pm.org',
       To => 'scott at illogics.org',
       From => 'scott at illogics.org',
       Subject => 'Thursday Meeting Automated Pre-Announcement',
       Message => message(),
     );
   }
}

sub message {
  my $thursdayith = $mday + 6;
  my $tail = substr($thursdayith, -1, 1);
  $thursdayith .= {
    0 => 'th',
    1 => 'st',
    2 => 'nd',
    3 => 'rd',
    4 => 'th',
    5 => 'th',
    6 => 'th',
    7 => 'th',
    8 => 'th',
    9 => 'th',
  }->{$tail};
  return <<MESSAGE;

Hi,

This is an automated message - this upcoming Thursday, the $thursdayith, is a Perl Mongers
night! 

Pack up your favorite old and new books, your problem code, your clever
hacks, pick a new or favorite module from CPAN or your library to mention,
if you want to share.

If no topic has been announced, this is your chance to present that 
algorithm or module or technique - it doesn't have to be spectacular -
people of all abilities show up and there is plenty of room for novice,
intermediate, and expert content. If you don't suggest something, Doug,
Kurt and Scott's inventory will be exhausted eventually, and no one wants
that.

Watch this space for confirmation of the meeting date and announcement of the
final topic selection. 

MESSAGE
}


On  0, Michael Friedman <friedman at highwire.stanford.edu> wrote:
> 
> Scott,
> 
> In case you didn't notice, next week Thursday is March 4th, not the 
> 30th of February by any definition... *grin*
> 
> So, what software did you use to generate this message? Something cool 
> with Date::* and Mail::Sendmail?
> 
> -- Mike
> 
> PS - I believe (Doug, please correct me if I'm wrong), that I'll be 
> talking about Automated Testing for this meeting. It won't take 2 hours 
> unless you have lots of questions, though, so bring any other 
> interesting ideas too.
> 
> 
> On Feb 24, 2004, at 1:00 AM, scott at illogics.org wrote:
> 
> >
> >
> > Hi,
> >
> > This is an automated message - this upcoming Thursday, the 30th, is a 
> > Perl Mongers
> > night!
> >
> > Pack up your favorite old and new books, your problem code, your clever
> > hacks, pick a new or favorite module from CPAN or your library to 
> > mention,
> > if you want to share.
> >
> > If no topic has been announced, this is your chance to present that
> > algorithm or module or technique - it doesn't have to be spectacular -
> > people of all abilities show up and there is plenty of room for novice,
> > intermediate, and expert content. If you don't suggest something, Doug,
> > Kurt and Scott's inventory will be exhausted eventually, and no one 
> > wants
> > that.
> >
> > Watch this space for confirmation of the meeting date and announcement 
> > of the
> > final topic selection.
> >
> >
> >
> ---------------------------------------------------------------------
> Michael Friedman                  HighWire Press, Stanford Southwest
> Phone: 480-456-0880                                   Tempe, Arizona
> FAX:   270-721-8034                  <friedman at highwire.stanford.edu>
> ---------------------------------------------------------------------
> 



More information about the Phoenix-pm mailing list