From: gfx Date: Fri, 10 Sep 2010 04:21:12 +0000 (+0900) Subject: Better version checks for conflicting modules X-Git-Tag: 0.66~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c4f4f5e361bf079c051eebabf630de10b6c17ca4;p=gitmo%2FMouse.git Better version checks for conflicting modules --- diff --git a/Makefile.PL b/Makefile.PL index f232a45..3a7e44f 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -33,15 +33,24 @@ my %suggests = ( ); 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', sprintf <<'CHECK', $mod, $least; +if(eval q{ use %1$s (); 1 }) { + if(eval q{ use %1$s %2$s (); 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" + ); } }