Creates a digest message from one list, to be sent to another list.
mojo_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.
You need to change two things on the top of mojo_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 Mojo libraries and your site's Perl library. Since mojo_digest.pl will most likely but run from a cron job, it doesn't know off the bat where the Perl or the Mojo 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/mojo/ /home/account/public_html/cgi-bin/mojo/MOJO /home/account/public_html/cgi-bin/mojo/MOJO/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 Mojo libraries are, they're in my cgi-bin right along with mojo.cgi. The ones after that are places where the site-wide Perl libraries are located.
Upload mojo_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 mojo scripts like this one in your home account:
mkdir /home/account/mojo_scripts
Putting this script in your cgi-bin would probably constitute a security threat!
change the permissions of mojo_digest.pl to 755.
To use this script, simple run it:
>perl mojo_digest.pl
That's the essence of it.
>perl mojo_digest.pl --test
>perl mojo_digest.pl --reset listname
listname is the shortname of the list you're grabbing the messages to be digested, not the digest list
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, mojo_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.
You're most likely going to run mojo_digest.pl via a crontab. Here's an example of one:
0 0,3,6,9,12,15,18,21 * * * /home/account/mojo_scripts/mojo_digest.pl
This will run the script every 3 hours to check if any digests need to be sent out.
Copyright (c) 1999 - 2003 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.