1 # COMPAT_TEST=1 genrates Moose compatible tests
4 if(grep{ $_ eq '--author' } @ARGV){
5 print "$^X -S cpanm < author/requires.cpanm\n";
6 system "$^X -S cpanm < author/requires.cpanm";
12 use inc::Module::Install 1.00;
15 use Module::Install::XSUtil 0.30;
16 use Module::Install::AuthorTests;
19 all_from 'lib/Mouse.pm';
21 # Scalar::Util < 1.14 has a bug.
22 # > Fixed looks_like_number(undef) to return false for perl >= 5.009002
23 requires 'Scalar::Util' => 1.14;
25 test_requires 'Test::More' => 0.88;
26 test_requires 'Test::Requires' => 0.06; # works on 5.6.0
27 test_requires 'Test::Exception::LessClever' => 0.005;
29 # to keep zero-dependencies
30 include 'Test::Exception::LessClever';
31 include 'Test::Requires';
36 'MouseX::AttributeHelpers' => 0.06,
38 while(my($mod, $least) = each %suggests){
39 my $status = system $^X, '-e', <<"CHECK";
40 if(eval q{ use $mod (); 1 }) {
41 if(eval q{ use $mod $least (); 1 }) {
42 exit 0; # installd, and new enough
45 exit 1; # installed, but too old
51 my $ver = `$^X -e "use $mod (); print $mod->VERSION"`;
53 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
54 " Please update $mod after installation of Mouse.\n",
60 # cc_want deals with the '--pp' and '--xs' options
61 my $use_xs = ($] >= 5.008_001 && want_xs());
64 print "Mouse configured with XS.\n";
69 cc_src_paths('xs-src');
72 print "Mouse configured with Pure Perl.\n";
75 tests 't/*.t t/*/*.t';
78 repository 'git://git.moose.perl.org/Mouse.git';
80 system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
81 or warn "Cannot generate Mouse::Tiny: $!";
82 makemaker_args PL_FILES => {
83 'tool/generate-mouse-tiny.pl' => 'lib/Mouse/Tiny.pm',
86 if ($Module::Install::AUTHOR) {
87 require 'lib/Mouse/Spec.pm'; # for the version
88 my $require_version = Mouse::Spec->MooseVersion;
91 && eval { require Moose; Moose->VERSION($require_version) }) {
92 print "You have Moose ", Moose->VERSION, ".\n";
93 do 'tool/create-moose-compatibility-tests.pl';
95 # see also ExtUtils::MM_Any::test_via_harness()
96 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
97 .q{ "test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')"}
98 .q{ xt/compat/t/*/*.t } . "\n";
100 postamble qq{test :: test_moose\n\n}
101 . qq{test_moose :: pure_all\n}
104 print "You don't have Moose $require_version. skipping moose compatibility test\n";
109 # see also ExtUtils::MM_Any::test_via_harness()
110 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
111 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')"}
112 .q{ $(TEST_FILES)} . "\n";
114 postamble qq{test :: test_pp\n\n}
115 . qq{test_pp :: pure_all\n}
119 # Hack to disable Test::Exception, which might pull a perl internal bug.
120 # See also Test::Exception::LessClever.
121 open my $out, '>', 'inc/Test/Exception.pm' or die $!;
123 package Test::Exception; # wapper to T::E::LessClever
124 require Test::Exception::LessClever;
125 $INC{'Test/Exception.pm'} = __FILE__;
128 Test::Exception::LessClever->export_to_level(1, @_);
132 close $out or die $!;
136 lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log
138 cover_db xs-src/*.gc{v,no,da}
141 WriteAll check_nmake => 0;