Oops! Add missing dependencies
[gitmo/Mouse.git] / Makefile.PL
index f232a45..4ea3b8c 100755 (executable)
@@ -8,10 +8,10 @@ BEGIN{
 
 use strict;
 use warnings;
-use inc::Module::Install 0.99;
+use inc::Module::Install 1.00;
 
 # for co-developpers
-use Module::Install::XSUtil 0.24;
+use Module::Install::XSUtil 0.27;
 use Module::Install::AuthorTests;
 
 system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
@@ -25,23 +25,32 @@ all_from 'lib/Mouse.pm';
 requires 'Scalar::Util' => 1.14;
 
 test_requires 'Test::More'      => 0.88;
+test_requires 'Test::Exception' => 0.29;
 
 my %suggests = (
     'Any::Moose'                     => 0.10,
     'Data::Util'                     => 0.55,
     'MouseX::AttributeHelpers'       => 0.06,
 );
-
 while(my($mod, $least) = each %suggests){
-    if(can_use($mod)){
-        if(!eval { $mod->VERSION($least) }){
-            my $ver = $mod->VERSION;
-            warn("\n",
-                "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
-                "         Please update $mod after installation of Mouse.\n",
-                "\n"
-            );
-        }
+    my $status = system $^X, '-e', <<"CHECK";
+if(eval q{ use $mod (); 1 }) {
+    if(eval q{ use $mod $least (); 1 }) {
+        exit 0; # installd, and new enough
+    }
+    else {
+        exit 1; # installed, but too old
+    }
+}
+CHECK
+
+    if($status != 0){
+        my $ver = `$^X -e "use $mod (); print $mod->VERSION"`;
+        warn("\n",
+            "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
+            "         Please update $mod after installation of Mouse.\n",
+            "\n"
+        );
     }
 }