CheckModuleVersion: minor enhancement
David Lee
t.d.lee at DURHAM.AC.UK
Fri Jul 2 16:05:06 IST 2004
Julian,
Many thanks for allowing "install.sh" to work on other OSes (in addition
to Linux). As part of trying to smooth one or two of its rough edges, I'd
like to request the attached patch to "CheckModuleVersion". This simply
re-enables the commented-out "print ..." statements if given a "-v"
(verbose) flag. (It is standalone and should have no other interaction;
however, it is very useful when trying to debug perl-module installation
aspects.)
--
: David Lee I.T. Service :
: Systems Programmer Computer Centre :
: University of Durham :
: http://www.dur.ac.uk/t.d.lee/ South Road :
: Durham :
: Phone: +44 191 334 2752 U.K. :
-------------------------- MailScanner list ----------------------
To leave, send leave mailscanner to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/ and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html
-------------- next part --------------
--- CheckModuleVersion.orig Tue Jun 1 16:13:24 2004
+++ CheckModuleVersion Fri Jul 2 14:35:49 2004
@@ -2,24 +2,28 @@
use strict;
+require "getopts.pl";
+
+&Getopts('v');
+
my $module = shift;
my $minimum = shift;
my($result, $version, $versionvar);
-#print "Checking installation status of Perl module $module...\n";
+print "Checking installation status of Perl module $module...\n" if $main::opt_v;
$versionvar = $module . "::VERSION";
$version = eval "require $module and defined \$$versionvar and \$$versionvar";
if ($@) {
- #print "Module $module is not installed.\n";
+ print "Module $module is not installed.\n" if $main::opt_v;
exit(1);
}
if ($version >= $minimum) {
- #print "Module is installed and version number is okay\n";
+ print "Module is installed and version number is okay ($version >= $minimum)\n" if $main::opt_v;
exit(0);
} else {
- #print "Module is installed but needs to be at least version $minimum (currently $version)\n";
+ print "Module is installed but needs to be at least version $minimum (currently $version)\n" if $main::opt_v;
exit(1);
}
More information about the MailScanner
mailing list