this patch adds the prerequisites checking functionality. Add more modules
as needed.

Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.37
diff -u -r1.37 Makefile.PL
--- Makefile.PL 2001/08/08 16:38:07     1.37
+++ Makefile.PL 2001/08/25 17:08:50
@@ -13,6 +13,65 @@

 our $VERSION;

+# prerequisites
+my %require =
+    (
+     'Tie::IxHash' => "1.21",
+    );
+
+
+# nice to have
+my %nice_to_have =
+    (
+     "GTop" => "0.09",
+    );
+
+
+for (keys %require) {
+    chk_version($_,$require{$_},0) or
+        warn  "\n"
+            . "*** For mod_perl 2.0 to work you are required to have"
+            . " the version $require{$_}, or later,\n"
+            . "of $_.pm from CPAN\n\n";
+}
+
+
+for (keys %nice_to_have) {
+    chk_version($_ ,$nice_to_have{$_}, 1);
+}
+
+
+sub chk_version{
+    my ($pkg, $wanted, $optional) = @_;
+    no strict 'refs';
+    local $| = 1;
+
+    print "Checking for $pkg...";
+    eval { (my $p = $pkg . ".pm") =~ s|::|/|g; require $p;};
+
+    if ($@) {
+        if ($optional) {
+            print("not ok (optional!)\n");
+        }
+        else {
+            print("not ok\n$@");
+        }
+        return;
+    }
+
+    my $vstr = ${"${pkg}::VERSION"}
+        ? "found v" . ${"${pkg}::VERSION"}
+        : "not found";
+    my $vnum = ${"${pkg}::VERSION"} || 0;
+
+    print $vnum >= $wanted ? "ok\n" : " " . $vstr . "\n";
+    return $vnum >= $wanted;
+
+}
+
+
+
+
 my $build = Apache::Build->new(init => 1);
 my $code  = ModPerl::Code->new;

@@ -30,6 +89,7 @@
     clean => {
         FILES => "@{ clean_files() }",
     },
+    PREREQ_PM => \%require,
 );

 post_configure();



_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to