new release: 0.07.2

fixes 'get_charset' and 'set_charset' for idx < 5.0
This commit is contained in:
lars 2006-06-20 02:03:55 +00:00
parent 0f25114208
commit 007dba196e
11 changed files with 1671 additions and 8 deletions

View File

@ -0,0 +1,49 @@
Revision history for Perl extension Mail::Ezmlm.
0.01 Sun Oct 31 12:58:16 1999
- original version; created by h2xs 1.1.1.1.2.1
0.02 Wed Jan 26 07:59:10 SAST 2000
- Added functions to check various options
(ismodsub, ismodpost, isremote, isdeny, isallow, isdigest)
- Allowed sub, unsub, list, subscribers, issub to work with list subparts
(ie, the allow, deny, mod, digest sub directories)
- Changed system() calls to safer ones (ie command, switches)
- Made error handling better (errmsg() and errno())
- Added support for creating MySQL tables via ezmlm-mktab
0.03 Mon Sep 25 11:49:26 SAST 2000
- fixed the issub() function
- fixed the problem with dashes in hostnames.
- hopefully got rid of some of the warnings from sub() and unsub()
0.04 Mon May 26 18:15:38 SAST 2003
- fixed return value of Makefile.PL (Andrew Pam <xanni@glasswings.com.au>)
- fixed issub() (again) to handle parts properly (bug 602; moguo@servism.com)
- converted module global variables to instance variables
0.05 Sat Mar 5 12:47:10 SAST 2005
- fixed forced scalar return in subscribers() (Jon Coulter <ledjon@ledjon.com>)
- fixed handling of dashes in hostnames (bug 5571; Lars Braeuer <lbraeuer@mpex.net>)
- fixed some tainting problems (Scott Beck <sbeck@gossamer-threads.com> and Matt Simerson <matt@tnpi.biz>)
- fixed order of control/defaulthost and control/me (bug 1515)
- fixed a bug in Makefile.PL (bug 11771). does not affect most users, so released as 0.05.1
0.06 Mon Dec 26 18:55:12 CET 2005
- support for ezmlm-idx-5.0.0 added
- fixed version check
0.07 Mon Jan 2 22:12:32 CET 2006
- new functions for text management (idx >= 5.0)
- new functions for language setting (idx >= 5.0)
- new functions for charset setting (idx >= 5.0)
- new functions for config directory setting (idx >= 5.0)
- look for ezmlm-make at run-time
- requires Text::ParseWords
0.07.1 Mon Jan 23 22:30:14 CET 2006
- fix misinterpretation of empty settings
0.07.2 Tue Jun 20 01:05:56 UTC 2006
- fixed 'get_charset' and 'set_charset' for idx < 5.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
Changes
Ezmlm.pm
MANIFEST
README
Makefile.PL
test.pl
META.yml

View File

@ -0,0 +1,10 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Ezmlm
version: 0.07.2
version_from: Ezmlm.pm
installdirs: site
requires:
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

View File

@ -0,0 +1,131 @@
# $Id: Makefile.PL,v 1.3 2005/03/05 14:15:20 guy Exp $
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'CONFIGURE' => \&set_paths,
'NAME' => 'Mail::Ezmlm',
'VERSION_FROM' => 'Ezmlm.pm', # finds $VERSION
'DISTNAME' => 'Ezmlm',
'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz' },
'clean' => { FILES => 'ezmlmtmp' }
);
sub set_paths {
my($qmail_path, $ezmlm_path);
# special case to handle the FreeBSD ports system
if ($ENV{BSD_BATCH_INSTALL}) {
print STDERR "\$BSD_BATCH_INSTALL is set in your environment, assuming port defaults\n";
return {};
}
print << 'EOM';
We now need to know where some things live on your system. I'll try and make
some intelligent guesses - if I get it right, please just press enter at the
prompt. If I get them wrong, please type in the correct path for me and then
press enter.
First I need to know where the Ezmlm binaries live (ie where I can find
ezmlm-make, ezmlm-sub, etc).
EOM
*prompt = \&ExtUtils::MakeMaker::prompt;
# guess default
$ezmlm_path = '/usr/local/bin/ezmlm';
$ezmlm_path = '/usr/local/bin/ezmlm-idx' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/local/bin' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/bin/ezmlm' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/bin/ezmlm-idx' unless (-e "$ezmlm_path/ezmlm-make");
$ezmlm_path = '/usr/bin' unless (-e "$ezmlm_path/ezmlm-make");
# return to default, if nothing can be found
$ezmlm_path = '/usr/local/bin/ezmlm' unless (-e "$ezmlm_path/ezmlm-make");
foreach (1..10) {
$ezmlm_path = prompt('Ezmlm binary directory?', "$ezmlm_path");
last if (-e "$ezmlm_path/ezmlm-make");
print "I can't find $ezmlm_path/ezmlm-make. Please try again\n";
}
unless (-e "$ezmlm_path/ezmlm-make") {
print STDERR "Warning: No correct input after $_ attempts. Continuing with warnings ...\n";
}
print << 'EOM';
Now I need to know where Qmail resides on your system. The Qmail base
directory is the one in which the Qmail bin, control, etc directories
live in.
EOM
foreach (1..10) {
$qmail_path = prompt('Qmail base directory?', '/var/qmail');
last if (-e "$qmail_path/control");
print "I can't find $qmail_path/control. Please try again\n";
}
if (! -e "$qmail_path/control") {
print STDERR "Warning: No correct input after $_ attempts. Continuing with warnings ...\n";
}
if(`strings $ezmlm_path/ezmlm-sub | grep -i 'MySQL'`) {
print << 'EOM';
It appears you have compiled MySQL support into your version of Ezmlm. If
this is correct, I now need to know where the MySQL client (mysql) lives on
your machine.
Please leave this blank if you do not want to enable MySQL support in the
Mail::Ezmlm module.
EOM
$mysql_path = '/usr/bin';
$mysql_path = '/usr/local/bin' unless (-e "$mysql_path/mysql");
# return to default - if nothing works
$mysql_path = '/usr/bin' unless (-e "$mysql_path/mysql");
foreach (1..10) {
$mysql_path = prompt('MySQL binary directory?', "$mysql_path");
last if (-e "$mysql_path/mysql" || $mysql_path eq '');
print "I can't find $mysql_path/mysql. Please enter the full path\n";
print "or leave this option blank if you don't want to use MySQL\n";
}
unless ((-e "$mysql_path/mysql") || ($mysql_path eq '')) {
print STDERR "Warning: No correct input after $_ attempts. Continuing with warnings ...\n";
}
}
print << 'EOM';
Thank you. I will use this information to configure Mail::Ezmlm for you
EOM
# Back up file
open(EZMLM, '<Ezmlm.pm') or die "Unable to open Ezmlm.pm for read: $!";
open(TMP, ">Ezmlm.pm.tmp.$$") or die "Unable to create temp file: $!";
while(<EZMLM>) { print TMP; }
close TMP; close EZMLM;
# Do variable substitution
open(EZMLM, '>Ezmlm.pm') or die "Unable to open Ezmlm.pm for write: $!";
open(TMP, "<Ezmlm.pm.tmp.$$") or die "Unable to read temp file: $!";
while(<TMP>) {
s{^\$EZMLM_BASE\s*=\s*['"].+?['"]\s*;\s*(#.*|)$}{\$EZMLM_BASE = '$ezmlm_path'; #Autoinserted by Makefile.PL};
s{^\$QMAIL_BASE\s*=\s*['"].+?['"]\s*;\s*(#.*|)$}{\$QMAIL_BASE = '$qmail_path'; #Autoinserted by Makefile.PL};
s{^\$MYSQL_BASE\s*=\s*['"].*?['"]\s*;\s*(#.*|)$}{\$MYSQL_BASE = '$mysql_path'; #Autoinserted by Makefile.PL};
print EZMLM;
}
close TMP; close EZMLM;
unlink "Ezmlm.pm.tmp.$$";
return {};
}

View File

@ -0,0 +1,21 @@
Ezmlm.pm
Object methods for ezmlm mailing lists.
Install by doing the following ...
# perl Makefile.PL
# make test
# make install
One thing. For some reason MakeMaker doesn't like symlinks. Please make sure
you use the full cantonical path for the qmail and ezmlm binaries.
Documentation is in pod format. Please run perldoc Mail::Ezmlm after you have
installed it.
Much as I'd like to, I don't have the time to regularly maintain this. New
releases are infrequent at best. Check http://guy.rucus.net/ezmlm/contrib/
for patches, etc that may be useful.
- Guy Antony Halse <guy-ezmlm@rucus.ru.ac.za>
- Lars Kruse <devel@sumpfralle.de>

View File

@ -0,0 +1,234 @@
# ===========================================================================
# test.pl - version 0.02 - 25/09/2000
# $Id: test.pl,v 1.5 2005/03/05 14:08:30 guy Exp $
# Test suite for Mail::Ezmlm
#
# Copyright (C) 1999, Guy Antony Halse, All Rights Reserved.
# Please send bug reports and comments to guy-ezmlm@rucus.ru.ac.za
#
# This program is subject to the restrictions set out in the copyright
# agreement that can be found in the Ezmlm.pm file in this distribution
#
# ==========================================================================
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
######################### We start with some black magic to print on failure.
$failed = 0;
BEGIN { $| = 1; print "1..9\n"; }
END {($failed++ && print "not ok 1\n") unless $loaded;}
use Mail::Ezmlm;
$loaded = 1;
print "Loading: ok 1\n";
######################### End of black magic.
# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):
use Cwd;
use File::Find;
$list = new Mail::Ezmlm;
# create a temp directory if necessary
$TMP = cwd() . '/ezmlmtmp';
mkdir $TMP, 0755 unless (-d $TMP);
print 'Checking list creation: ';
$test1 = $list->make(-name=>"ezmlm-test1-$$",
-qmail=>"$TMP/.qmail-ezmlm-test1-$$",
-dir=>"$TMP/ezmlm-test1-$$");
if($test1 eq "$TMP/ezmlm-test1-$$") {
print "ok 2\n";
} else {
print 'not ok 2 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Checking vhost list creation: ';
$test2 = $list->make(-name=>"ezmlm-test2-$$",
-qmail=>"$TMP/.qmail-ezmlm-test2-$$",
-dir=>"$TMP/ezmlm-test2-$$",
-host=>'on.web.za',
-user=>'onwebza');
if($test2 eq "$TMP/ezmlm-test2-$$") {
open(INLOCAL, "<$TMP/ezmlm-test2-$$/inlocal");
chomp($test2 = <INLOCAL>);
close INLOCAL;
if($test2 eq "onwebza-ezmlm-test2-$$") {
print "ok 3\n";
} else {
print 'not ok 3 [', $list->errmsg(), "]\n";
$failed++;
}
} else {
print 'not ok 3 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing list update: ';
if($list->update('ms')) {
print "ok 4\n";
} else {
print 'not ok 4 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing setlist() and thislist(): ';
$list->setlist("$TMP/ezmlm-test1-$$");
if($list->thislist eq "$TMP/ezmlm-test1-$$") {
print "ok 5\n";
} else {
print 'not ok 5 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing list subscription and subscription listing: ';
$list->sub('nobody@on.web.za');
$list->sub('anonymous@on.web.za', 'test@on.web.za');
@subscribers = $list->subscribers;
if($subscribers[1] =~ /nobody\@on.web.za/) {
print "ok 6\n";
} else {
print 'not ok 6 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing issub(): ';
if(defined($list->issub('nobody@on.web.za'))) {
if(defined($list->issub('some@non.existant.address'))) {
print 'not ok 7 [', $list->errmsg(), "]\n";
$failed++;
} else {
print "ok 7\n";
}
} else {
print 'not ok 7 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing list unsubscription: ';
$list->unsub('nobody@on.web.za');
$list->unsub('anonymous@on.web.za', 'test@on.web.za');
@subscribers = $list->subscribers;
unless(@subscribers) {
print "ok 8\n";
} else {
print 'not ok 8 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing installed version of ezmlm: ';
my($version) = $list->check_version();
if ($version) {
$version =~ s/\n//;
print 'not ok 9 [Warning: Ezmlm.pm is designed to work with ezmlm-idx > 0.40. Your version reports as: ', $version, "]\n";
} else {
print "ok 9\n";
}
print 'Testing retrieving of text files: ';
if ($list->get_text_content('sub-ok') ne '') {
print "ok 10\n";
} else {
print 'not ok 10 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing changing of text files: ';
$list->set_text_content('sub-ok', "testing message\n");
if ($list->get_text_content('sub-ok') eq "testing message\n") {
print "ok 11\n";
} else {
print 'not ok 11 [', $list->errmsg(), "]\n";
$failed++;
}
print 'Testing if text file is marked as customized (only idx >= 5.0): ';
if ($list->get_version() >= 5) {
if ($list->is_text_default('sub-ok')) {
print 'not ok 12 [', $list->errmsg(), "]\n";
$failed++;
} else {
print "ok 12\n";
}
} else {
print "ok 12 [skipped]\n";
}
print 'Testing resetting text files (only idx >= 5.0): ';
if ($list->get_version() >= 5) {
$list->reset_text('sub-ok');
if ($list->is_text_default('sub-ok')) {
print "ok 13\n";
} else {
print 'not ok 13 [', $list->errmsg(), "]\n";
$failed++;
}
} else {
print "ok 13 [skipped]\n";
}
print 'Testing retrieving available languages (only idx >= 5.0): ';
if ($list->get_version() >= 5) {
my @avail_langs = $list->get_available_languages();
if ($#avail_langs > 0) {
print "ok 14\n";
} else {
print 'not ok 14 [', $list->errmsg(), "]\n";
$failed++;
}
} else {
print "ok 14 [skipped]\n";
}
print 'Testing changing the configured language (only idx >= 5.0): ';
if ($list->get_version() >= 5) {
my @avail_langs = $list->get_available_languages();
$list->set_lang($avail_langs[$#avail_langs-1]);
if ($list->get_lang() eq $avail_langs[$#avail_langs-1]) {
print "ok 15\n";
} else {
print 'not ok 15 [', $list->errmsg(), "]\n";
$failed++;
}
} else {
print "ok 15 [skipped]\n";
}
print 'Testing getting the configuration directory (only idx >= 5.0): ';
if ($list->get_version() >= 5) {
if ($list->get_config_dir() ne '') {
print "ok 16\n";
} else {
print 'not ok 16 [', $list->errmsg(), "]\n";
$failed++;
}
} else {
print "ok 16 [skipped]\n";
}
print 'Testing changing the configuration directory (only idx >= 5.0): ';
if ($list->get_version() >= 5) {
$list->set_config_dir('/etc/ezmlm-local');
if ($list->get_config_dir() eq '/etc/ezmlm-local') {
print "ok 17\n";
} else {
print 'not ok 17 [', $list->errmsg(), "]\n";
$failed++;
}
} else {
print "ok 17 [skipped]\n";
}
if($failed > 0) {
print "\n$failed tests were failed\n";
exit $failed;
} else {
print "\nSuccessful :-)\n";
finddepth(sub { (-d $File::Find::name) ? rmdir ($File::Find::name) : unlink ($File::Find::name) }, cwd() . "/ezmlmtmp");
exit;
}

Binary file not shown.

View File

@ -47,3 +47,6 @@ Revision history for Perl extension Mail::Ezmlm.
0.07.2 Sun May 6 06:20:13 CEST 2006
- fix parsing of ezmlm-make options
0.07.2 Tue Jun 20 01:05:56 UTC 2006
- fixed 'get_charset' and 'set_charset' for idx < 5.0

View File

@ -546,12 +546,11 @@ sub set_lang {
}
# == get the selected charset of the list (idx >= 5.0) ==
# return empty string for idx < 5.0
# == get the selected charset of the list ==
# return default value (us-ascii) if no charset is specified
sub get_charset {
my ($self) = shift;
my $charset;
return '' if (get_version() < 5);
chomp($charset = $self->getpart('charset'));
# default if no 'charset' file exists
$charset = 'us-ascii' if ($charset eq '');
@ -560,12 +559,10 @@ sub get_charset {
# == set the selected charset of the list (idx >= 5.0) ==
# return without error for idx < 5.0
# remove list' specific charset file, if the default charset of the current language
# was chosen
sub set_charset {
my ($self, $charset) = @_;
return (0==0) if (get_version() < 5);
# first: remove current charset
unlink "$self->{'LIST_NAME'}/charset";
# second: get default value of the current language
@ -1118,9 +1115,9 @@ system-wide default text file, if there is no customized text file for this list
$list->get_config_dir;
$list->set_config_dir('/etc/ezmlm-local');
These function access the file 'conf-etc' in the mailing list's directory. The
static function always returns the default configuration directory of ezmlm-idx
(/etc/ezmlm).
These functions access the file 'conf-etc' in the mailing list's directory. The
static function (first example) always returns the default configuration directory
of ezmlm-idx (/etc/ezmlm).
$list->get_available_languages;
$list->get_lang;