Revert "Use check_conflicts from Module::Install"
[gitmo/Class-MOP.git] / Makefile.PL
index 41aaab6..13b1775 100644 (file)
@@ -8,12 +8,6 @@ perl_version '5.008001';
 all_from 'lib/Class/MOP.pm';
 license 'perl';
 
-my %conflicts = (
-    'Moose' => '1.04',
-);
-
-check_conflicts(%conflicts);
-
 require Config;
 my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
 
@@ -75,6 +69,47 @@ EOM
 
 WriteAll();
 
+# Use the cpan-smolder-stable script in the Moose svn root to figure
+# out what on CPAN will break with the latest Moose, then update this
+# before a release.
+sub check_conflicts {
+    my %conflicts = (
+        'Moose' => '1.04',
+    );
+
+    my $found = 0;
+    for my $mod ( sort keys %conflicts ) {
+        eval "require $mod";
+        next if $@;
+
+        my $installed = $mod->VERSION();
+        if ( $installed le $conflicts{$mod} ) {
+
+            print <<"EOF";
+
+***
+    This version of Class::MOP conflicts with the version of
+    $mod ($installed) you have installed.
+
+    You will need to upgrade $mod after installing
+    this version of Class::MOP.
+***
+
+EOF
+
+            $found = 1;
+        }
+    }
+
+    return unless $found;
+
+    # More or less copied from Module::Build
+    return if $ENV{PERL_MM_USE_DEFAULT};
+    return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
+
+    sleep 4;
+}
+
 package MY;
 
 use Config;