No need to pass an index to an array when we can pass the array member
[gitmo/Class-MOP.git] / Makefile.PL
CommitLineData
591a9381 1use strict;
2use warnings;
89dc39a9 3use inc::Module::Install;
4use 5.008001;
5
6check_conflicts();
7
8name 'Class-MOP';
9perl_version '5.008001';
10all_from 'lib/Class/MOP.pm';
11license 'perl';
591a9381 12
d846ade3 13my $ccflags = ' -I.';
14$ccflags .= ' -Wall' if -d '.svn' || -d '.git' || $ENV{MAINTAINER_MODE};
f125b31e 15
89dc39a9 16requires 'Carp';
17requires 'Devel::GlobalDestruction';
d065fbe6 18requires 'MRO::Compat' => '0.05';
19requires 'Scalar::Util' => '1.18';
20requires 'Sub::Name' => '0.04';
89dc39a9 21requires 'Task::Weaken';
22
23test_requires 'File::Spec';
24test_requires 'Test::More' => '0.77';
25test_requires 'Test::Exception' => '0.21';
26
27makemaker_args( CCFLAGS => $ccflags );
28
d846ade3 29{
30 my (@clean, @OBJECT, %XS);
31
32 for my $xs (<xs/*.xs>) {
33 (my $c = $xs) =~ s/\.xs$/.c/i;
34 (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
35
36 $XS{$xs} = $c;
37 push @OBJECT, $o;
38 push @clean, $o;
39 }
40
41 for my $c (<*.c>) {
42 (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
43 push @OBJECT, $o;
44 push @clean, $o;
45 }
46
47 makemaker_args(
48 clean => { FILES => join(q{ }, @clean) },
49 OBJECT => join (q{ }, @OBJECT),
50 XS => \%XS,
51 );
52}
53
8a9fe086 54postamble(<<'EOM');
55$(OBJECT) : mop.h
56EOM
57
89dc39a9 58WriteAll();
59
60# Use the cpan-smolder-stable script in the Moose svn root to figure
61# out what on CPAN will break with the latest Moose, then update this
62# before a release.
63sub check_conflicts {
64 my %conflicts = (
65 'Moose' => '0.71',
66 );
67
68 my $found = 0;
69 for my $mod ( sort keys %conflicts ) {
70 eval "require $mod";
71 next if $@;
72
73 my $installed = $mod->VERSION();
74 if ( $installed le $conflicts{$mod} ) {
75
76 print <<"EOF";
77
78***
79 This version of Class::MOP conflicts with the version of
80 $mod ($installed) you have installed.
81
82 You will need to upgrade $mod after installing
83 this version of Class::MOP.
84***
85
86EOF
87
88 $found = 1;
89 }
90 }
91
92 return unless $found;
93
94 # More or less copied from Module::Build
d065fbe6 95 return if $ENV{PERL_MM_USE_DEFAULT};
96 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
89dc39a9 97
98 sleep 4;
99}
d846ade3 100
101package MY;
102
103use Config;
104
105sub const_cccmd {
106 my $ret = shift->SUPER::const_cccmd(@_);
107 return q{} unless $ret;
108
109 if ($Config{cc} =~ /^cl\b/i) {
110 warn 'you are using MSVC... my condolences.';
111 $ret .= ' /Fo$@';
112 }
113 else {
114 $ret .= ' -o $@';
115 }
116
117 return $ret;
118}