add namespace::clean 0.18 as a conflict
[gitmo/Package-Stash.git] / inc / MMPackageStash.pm
CommitLineData
354ce5a6 1package inc::MMPackageStash;
2use Moose;
3
4extends 'Dist::Zilla::Plugin::MakeMaker::Awesome';
5
6# XXX: this is pretty gross, it should be possible to clean this up later
7around _build_MakeFile_PL_template => sub {
8 my $orig = shift;
9 my $self = shift;
10 my $template = $self->$orig(@_);
11
12 $template =~ s/(use ExtUtils::MakeMaker.*)/$1\n\ncheck_conflicts();/;
13
14 $template .= <<'CHECK_CONFLICTS';
15sub check_conflicts {
16 my %conflicts = (
dc378b60 17 'Class::MOP' => '1.08',
18 'MooseX::Role::WithOverloading' => '0.08',
b6f2c7d8 19 'namespace::clean' => '0.18',
354ce5a6 20 );
21 my $found = 0;
22 for my $mod ( sort keys %conflicts ) {
23 eval "require $mod";
24 next if $@;
25
26 my $installed = $mod->VERSION();
27 if ( $installed le $conflicts{$mod} ) {
28
29 print <<"EOF";
30
31***
32 This version of Package::Stash conflicts with the version of
33 $mod ($installed) you have installed.
34
35 You will need to upgrade $mod after installing
36 this version of Package::Stash.
37***
38
39EOF
40
41 $found = 1;
42 }
43 }
44
45 return unless $found;
46
47 # More or less copied from Module::Build
48 return if $ENV{PERL_MM_USE_DEFAULT};
49 return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
50
51 sleep 4;
52}
53CHECK_CONFLICTS
54
55 return $template;
56};
57
58__PACKAGE__->meta->make_immutable;
59no Moose;
60
611;