Dada Digest Script

- NAME dada_digest.pl
- DESCRIPTION
- INSTRUCTIONS
- INSTALLTION

- OPTIONS
- SETTING UP A DIGEST
- Setting up a Cron Tab

- COPYRIGHT

# NAME dada_digest.pl

# DESCRIPTION

Creates a digest message from one list, to be sent to another list.

# INSTRUCTIONS

dada_digest.pl is designed to be called from the command line or a cron job. It is not a cgi script and shys away from the limelight that is the Graphical WWW.

# INSTALLTION

You need to change two things on the top of dada_digest.pl, the first is the $Digests variable which we'll get to shortly, the second thing you need to do is set the path to both the Dada libraries and your site's Perl library. Since dada_digest.pl will most likely but run from a cron job, it doesn't know off the bat where the Perl or the Dada libraries are. You tell the script where these places are by tweaking the 'use lib' statement:

use lib qw( /home/account/public_html/cgi-bin/dada/ /home/account/public_html/cgi-bin/dada/DADA /home/account/public_html/cgi-bin/dada/DADA/perllib /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 );

The first two are where my Dada libraries are, they're in my cgi-bin right along with mail.cgi. The ones after that are places where the site-wide Perl libraries are located.

Upload dada_digest.pl to your hosting account. I recommend NOT putting this script in your cgi-bin, simply because it isn't a cgi-script. You may want to make a directory for dada scripts like this one in your home account:

     mkdir /home/account/dada_scripts

Putting this script in your cgi-bin would probably constitute a security threat!

change the permissions of dada_digest.pl to 755.

To use this script, simple run it:

     >perl dada_digest.pl

That's the essence of it.

## OPTIONS

--test

  running dada_digest.pl with the test option will only send out the digest to the list owner. Very handy for testing purposes.

       >perl dada_digest.pl --test

--reset listname

  This takes a bit of explaination, but it basically resets the time dada_digest.pl remembers when it last sent out a digest. If I send out a digest ever day, dada_digest.pl will remember this and won't send out a message in a digest it has already sent. This will make dada_digest.pl forget this.

       >perl dada_digest.pl --reset listname

  listname is the shortname of the list you're grabbing the messages to be digested, not the digest list

## SETTING UP A DIGEST

To set up a digest, You need to have two lists, a list to grab the messages to be digested from and a list to send the digest. I made a list with a shortname of 'test' and another with a shortname of 'digest_test'

People who want to have every single message sent to them would want to subscribe to 'test', people who want the digest would want to subscribe to 'digest_test'

I then have to decide what sort of time span I want to send my digest. I'm thinking every day will work for me.

Now, dada_digest.pl needs to know all of this. On the top of the script itself is a variable called '$Digests'. To put the above information that I just worked out into $Digests, I'd write:

            my $Digests = [
            {
            List_Name         => 'test',
            Digest_List_Name  => 'digest_test',
            Message_History   =>  24,
            },
            ];

Message_History work in hours, so one day equals 24 hours.

If I had another list, called ``ramblings'' and a list for digests called ``digest_ramblings'', that I wanted sent every 3 hours, I'd put that after my first one:

            my $Digests = [
            {
            List_Name         => 'test',
            Digest_List_Name  => 'digest_test',
            Message_History   =>  24,
            },
            {
            List_Name         => 'ramblings',
            Digest_List_Name  => 'digest_ramblings',
            Message_History   =>  3,
            },
            ];

All there is to it.

## Setting up a Cron Tab

You're most likely going to run dada_digest.pl via a crontab. Here's an example of one:

     0 0,3,6,9,12,15,18,21 * * * /home/account/dada_scripts/dada_digest.pl

This will run the script every 3 hours to check if any digests need to be sent out.

# COPYRIGHT

Copyright (c) 1999 - 2008 Justin Simoni me@justinsimoni.com http://justinsimoni.com

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.