Add conflict detection for modules we know break with this release of
[gitmo/Moose.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use inc::Module::Install;
4
5 check_conflicts();
6
7 name 'Moose';
8 all_from 'lib/Moose.pm';
9 license 'perl';
10
11 # Scalar::Util 1.18 doesn't work on Windows
12 my $win32 = !! ( $^O eq 'Win32' or $^O eq 'cygwin' );
13
14 # prereqs
15 requires 'perl'             => '5.008';
16 requires 'Scalar::Util' => $win32 ? '1.17' : '1.18';
17 requires 'Carp';
18 requires 'Class::MOP'       => '0.65';
19 requires 'List::MoreUtils';
20 requires 'Sub::Exporter'    => '0.972';
21
22 # only used by oose.pm, not Moose.pm :P
23 requires 'Filter::Simple' => '0'; 
24
25 # things the tests need
26 build_requires 'Test::More'      => '0.62';
27 build_requires 'Test::Exception' => '0.21';
28 build_requires 'Test::LongString';
29
30 tests_recursive;
31
32 WriteAll();
33
34 # Use the cpan-smolder-stable script in the Moose svn root to figure
35 # out what on CPAN will break with the latest Moose, then update this
36 # before a release.
37 sub check_conflicts {
38     my %conflicts = (
39         'MooseX::Singleton'        => '0.11',
40         'MooseX::Params::Validate' => '0.05',
41         'Fey::ORM'                 => '0.10',
42     );
43
44     my $found = 0;
45     for my $mod ( sort keys %conflicts ) {
46         eval "require $mod";
47         next if $@;
48
49         my $installed = $mod->VERSION();
50         if ( $installed le $conflicts{$mod} ) {
51
52             print <<"EOF";
53
54 ***
55     This version of Moose conflicts with the version of
56     $mod ($installed) you have installed.
57
58     You will need to upgrade $mod after installing
59     this version of Moose.
60 ***
61
62 EOF
63
64             $found = 1;
65         }
66     }
67
68     # More or less copied from Module::Build
69     return if  $ENV{PERL_MM_USE_DEFAULT};
70     return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
71
72     sleep 4 if $found;
73 }