[Mimedefang] two quick enhancement suggestions for mimedefang.pl

Stephane Lentz Stephane.Lentz at ansf.alcatel.fr
Mon Sep 2 17:43:00 EDT 2002


On Mon, Sep 02, 2002 at 04:12:19PM +0200, Stephane Lentz wrote:
> On Mon, Sep 02, 2002 at 11:49:53PM +1000, Tony Nugent wrote:
> > David,
> > 
> > ...
> > And it is possible to have the features output include the installed
> > versions of the perl modules it is using?
> > 
> 
> Yes : 
> perl -e 'require Mail::Util ; print Mail::Util->VERSION()'
> 
> pmvers should be a standard perl script !
> 
> http://groups.google.fr/groups?selm=36c89a9e%40csnews&oe=UTF-8&output=gplain

Based on this, here is a patch against 2.19 : 
I'm introducing a $release variable and the output is for instance :
 
[root at angel root]#     /usr/bin/mimedefang.pl     -version
MIMEDefang                    : 2.19
MIME::Tools                   : 5.411
IO::Socket                    : 1.26
Digest::SHA1                  : 2.01
File::Scan                    : MISSING
Anomy::HTMLCleaner            : MISSING

David, I hope it can help :-)

Regards, 

SL/
---
Stephane Lentz / Alcanet International - Internet Services
-------------- next part --------------
--- /usr/bin/mimedefang.pl.219	Mon Sep  2 22:57:44 2002
+++ /usr/bin/mimedefang.pl	Mon Sep  2 23:38:52 2002
@@ -41,6 +41,7 @@
 
 use vars qw($GeneralWarning);
 use vars qw($HTMLFoundEndBody $HTMLBoilerplate $SASpamTester);
+use vars qw($release);
 
 use IO::Socket;
 use MIME::Tools 5.410 ();
@@ -83,6 +84,9 @@
 # Sys::Syslog gives a bunch of warnings in strict mode on Linux...
 use Sys::Syslog qw(:DEFAULT setlogsock);
 
+# MIMEDefang version
+$release = "2.19"; 
+
 # No stupidity yet
 $Stupidity{"flatten"} = 0;
 
@@ -2765,7 +2769,7 @@
 	}
     }
     if ($#ARGV != 0) {
-	print STDERR "Usage: mimedefang.pl [-f filter] workdir | -server | -test | -structure | -features\n";
+	print STDERR "Usage: mimedefang.pl [-f filter] workdir | -server | -test | -structure | -features | -version\n";
 	return 1;
     }
 
@@ -2818,6 +2822,27 @@
 	print_message_structure();
 	exit(0);
     }
+    if ($WorkDir eq "-version") {
+	my ($module, $version);
+	# Give Mimedefang & required Perl modules versions
+	printf("%-30s: %s\n","MIMEDefang",$release);
+	for $module qw(MIME::Tools IO::Socket Digest::SHA1 File::Scan Anomy::HTMLCleaner) {
+	    eval "require $module";
+	    printf("%-30s: ",$module);
+	    if ( $@ )  {
+		print "MISSING\n"; 
+	    }
+	    elsif (defined($version = $module->VERSION())) { 
+		print"$version\n";
+	    }
+	    else { 
+		    print "UNKNOWN VERSION\n";
+		}
+	}
+    	exit 0;
+    }
+
+
     if ($WorkDir eq "-features") {
 	# Print available features
 	my($thing, $ans);


More information about the MIMEDefang mailing list