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;
27 # to keep zero-dependencies
28 include 'Test::Exception::LessClever';
29 include 'Test::Requires';
34 'MouseX::AttributeHelpers' => 0.06,
36 while(my($mod, $least) = each %suggests){
37 my $status = system $^X, '-e', <<"CHECK";
38 if(eval q{ use $mod (); 1 }) {
39 if(eval q{ use $mod $least (); 1 }) {
40 exit 0; # installd, and new enough
43 exit 1; # installed, but too old
49 my $ver = `$^X -e "use $mod (); print $mod->VERSION"`;
51 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
52 " Please update $mod after installation of Mouse.\n",
58 # cc_want deals with the '--pp' and '--xs' options
59 my $use_xs = ($] >= 5.008_001 && want_xs());
62 print "Mouse configured with XS.\n";
67 cc_src_paths('xs-src');
70 print "Mouse configured with Pure Perl.\n";
73 tests 't/*.t t/*/*.t';
76 repository 'git://git.moose.perl.org/Mouse.git';
78 system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
79 or warn "Cannot generate Mouse::Tiny: $!";
80 makemaker_args PL_FILES => {
81 'tool/generate-mouse-tiny.pl' => 'lib/Mouse/Tiny.pm',
84 if ($Module::Install::AUTHOR) {
85 require 'lib/Mouse/Spec.pm'; # for the version
86 my $require_version = Mouse::Spec->MooseVersion;
89 && eval { require Moose; Moose->VERSION($require_version) }) {
90 print "You have Moose ", Moose->VERSION, ".\n";
91 do 'tool/create-moose-compatibility-tests.pl';
93 # see also ExtUtils::MM_Any::test_via_harness()
94 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
95 .q{ "test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')"}
96 .q{ xt/compat/t/*/*.t } . "\n";
98 postamble qq{test :: test_moose\n\n}
99 . qq{test_moose :: pure_all\n}
102 print "You don't have Moose $require_version. skipping moose compatibility test\n";
107 # see also ExtUtils::MM_Any::test_via_harness()
108 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
109 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')"}
110 .q{ $(TEST_FILES)} . "\n";
112 postamble qq{test :: test_pp\n\n}
113 . qq{test_pp :: pure_all\n}
117 # Hack to disable Test::Exception, which might pull a perl internal bug.
118 # See also Test::Exception::LessClever.
119 open my $out, '>', 'inc/Test/Exception.pm' or die $!;
121 package Test::Exception; # wapper to T::E::LessClever
122 require Test::Exception::LessClever;
123 $INC{'Test/Exception.pm'} = __FILE__;
126 Test::Exception::LessClever->export_to_level(1, @_);
130 close $out or die $!;
134 lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log
136 cover_db xs-src/*.gc{v,no,da}
139 WriteAll check_nmake => 0;