revert vivication changes for now again
[gitmo/Package-Stash-XS.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 = (
67b17048 17 # 'Class::MOP' => '1.08',
18 # 'MooseX::Role::WithOverloading' => '0.08',
354ce5a6 19 );
20 my $found = 0;
21 for my $mod ( sort keys %conflicts ) {
22 eval "require $mod";
23 next if $@;
24
25 my $installed = $mod->VERSION();
26 if ( $installed le $conflicts{$mod} ) {
27
28 print <<"EOF";
29
30***
31 This version of Package::Stash conflicts with the version of
32 $mod ($installed) you have installed.
33
34 You will need to upgrade $mod after installing
35 this version of Package::Stash.
36***
37
38EOF
39
40 $found = 1;
41 }
42 }
43
44 return unless $found;
45
46 # More or less copied from Module::Build
47 return if $ENV{PERL_MM_USE_DEFAULT};
48 return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
49
50 sleep 4;
51}
52CHECK_CONFLICTS
53
54 return $template;
55};
56
57__PACKAGE__->meta->make_immutable;
58no Moose;
59
601;