I've just spent a while merging my local version of qpsmtpd with the changes present in the subversion repository and noticed a few minor irritations.
There are several of the plugins contained are in the repository which fail to pass a basic perl syntax check, for example: [EMAIL PROTECTED]:~/svn/qpsmtpd$ perl -Tc ./plugins/greylisting Bareword "LOGALERT" not allowed while "strict subs" in use at ... ./plugins/greylisting had compilation errors. This can be fixed easily by adding "use Qpsmtpd::Constants;" to the top of the plugin. Please find attached a diff against the current SVN repository which does two thins: 1. Adds the necessary "Qpsmtpd::Constants" to all plugins which are currently missing it. 2. Adds a new test case "t/perl-syntax.t" to ensure all plugins pass Perl's syntax check. Note that the new test file might give you false positives. For example the following fails for me: [EMAIL PROTECTED]:~/svn/qpsmtpd$ perl -c plugins/ident/geoip Can't locate Geo/IP.pm in @INC .. Clearly this is because I've not installed the dependency for this plugin. But personally I'd rather see the test added than not, and desired I'd be happy to add a list of exceptions. (Although I suspect down that path lies madness..) Steve -- http://mail-scanning.com/
Index: plugins/milter =================================================================== Index: plugins/auth/auth_ldap_bind =================================================================== Index: plugins/ident/geoip =================================================================== Index: plugins/queue/exim-bsmtp =================================================================== --- plugins/queue/exim-bsmtp (revision 934) +++ plugins/queue/exim-bsmtp (working copy) @@ -64,6 +64,7 @@ use IO::File; use Sys::Hostname qw(hostname); use File::Temp qw(tempfile); +use Qpsmtpd::Constants; sub register { my ($self, $qp, %args) = @_; Index: plugins/logging/file =================================================================== --- plugins/logging/file (revision 934) +++ plugins/logging/file (working copy) @@ -122,6 +122,7 @@ use IO::File; use Sys::Hostname; use POSIX qw(strftime); +use Qpsmtpd::Constants; sub register { my ($self, $qp, @args) = @_; Index: plugins/logging/syslog =================================================================== --- plugins/logging/syslog (revision 934) +++ plugins/logging/syslog (working copy) @@ -109,6 +109,7 @@ use warnings; use Sys::Syslog qw(:DEFAULT setlogsock); +use Qpsmtpd::Constants; sub register { my ($self, $qp, @args) = @_; Index: plugins/greylisting =================================================================== --- plugins/greylisting (revision 934) +++ plugins/greylisting (working copy) @@ -122,6 +122,7 @@ use AnyDBM_File; use Fcntl qw(:DEFAULT :flock); use strict; +use Qpsmtpd::Constants; my $VERSION = '0.07'; Index: plugins/domainkeys =================================================================== Index: plugins/virus/clamav =================================================================== --- plugins/virus/clamav (revision 934) +++ plugins/virus/clamav (working copy) @@ -111,6 +111,8 @@ use strict; use warnings; +use Qpsmtpd::Constants; + sub register { my ($self, $qp, @args) = @_; my %args; Index: plugins/virus/clamdscan =================================================================== Index: plugins/virus/bitdefender =================================================================== --- plugins/virus/bitdefender (revision 934) +++ plugins/virus/bitdefender (working copy) @@ -64,6 +64,7 @@ use strict; use warnings; +use Qpsmtpd::Constants; sub register { my ( $self, $qp, @args ) = @_; Index: plugins/check_earlytalker =================================================================== --- plugins/check_earlytalker (revision 934) +++ plugins/check_earlytalker (working copy) @@ -59,6 +59,7 @@ use warnings; use strict; +use Qpsmtpd::Constants; sub register { my ($self, $qp, @args) = @_; Index: t/perl-syntax.t =================================================================== --- t/perl-syntax.t (revision 0) +++ t/perl-syntax.t (revision 0) @@ -0,0 +1,52 @@ +#!/usr/bin/perl -w +# +# Test that every plugin we have passes the basic perl syntax check +# +# Steve +# -- +# + +use strict; +use File::Find; +use Test::More qw( no_plan ); + + +# +# Find the plugin directory and test them +# +my $dir = "./plugins"; +$dir = "../plugins/" if ( -d "./../plugins/" ); + +find( {wanted => \&checkFile, no_chdir => 1}, $dir ); + + + +=begin doc + + Check the named file to see if it contains any perl syntax errors. + +=end doc + +=cut + +sub checkFile +{ + + # The file. + my $file = $File::Find::name; + + # We don't care about directories + return if ( !-f $file ); + + # Nor about SVN files. + return if ( $file =~ /\.svn/i ); + + # + # Now run 'perl -c $file' to see if we pass the syntax + # check. + # + my $retval = system("perl -Tc $file 2>/dev/null >/dev/null"); + + + is( $retval, 0, "Perl file passes our syntax check: $file" ); +} Property changes on: t/perl-syntax.t ___________________________________________________________________ Added: svn:executable + *