X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile.PL;h=aa7620c0e743b5d5ecb210316f665e9c4209e2f8;hb=6a1f6d32acb15db4991383556319a25b4fb34aa2;hp=c694d47b87386b40daaf7076a83c51a893991555;hpb=314fe3048f1aa8eb5d77b32040b4355b19a0c676;p=gitmo%2FMouse.git diff --git a/Makefile.PL b/Makefile.PL index c694d47..aa7620c 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,5 @@ use inc::Module::Install; +use 5.008; name 'Mouse'; all_from 'lib/Mouse.pm'; @@ -9,8 +10,8 @@ tests 't/*.t t/*/*.t'; # > Fixed looks_like_number(undef) to return false for perl >= 5.009002 requires 'Scalar::Util' => 1.14; -build_requires 'Test::Exception'; -build_requires 'Test::More'; +build_requires 'Test::Exception' => 0.21; +build_requires 'Test::More' => 0.80; if ($Module::Install::AUTHOR) { if (eval "package foo; use Moose; 1;") { @@ -23,14 +24,16 @@ if ($Module::Install::AUTHOR) { } else { print "you don't have a moose. skipping moose compatibility test\n"; } + system("author/generate-mouse-tiny.pl"); } auto_include; WriteAll; sub create_moose_compatibility_test { - require Path::Class; - Path::Class->import('file', 'dir'); + require File::Path; + require File::Spec; + require File::Basename; # some test does not pass... currently skip it. my %SKIP_TEST = ( @@ -51,24 +54,37 @@ sub create_moose_compatibility_test { '031_roles_applied_in_create.t' => 'wtf?', ); - dir('t')->recurse( - callback => sub { - my $f = shift; - return if $f->is_dir; - return if $f =~ /\.sw[po]$/; - return if $SKIP_TEST{$f->basename}; + File::Find::find( + { + wanted => sub { + return unless -f $_; + my $basename = File::Basename::basename($_); + return if $basename =~ /^\./; + return if $SKIP_TEST{$basename}; + + my $dirname = File::Basename::dirname($_); - my $dstfile = dir('xt', 'compatibility')->file($f); - $dstfile->dir->mkpath(); + my $tmpdir = File::Spec->catfile('xt', 'compatibility', $dirname); + File::Path::mkpath($tmpdir); - my $fh = $dstfile->openw(); - $fh->print(do { - local $_ = $f->slurp; - s/Mouse/Moose/g; - $_; - }); - $fh->close(); + my $tmpfile = File::Spec->catfile($tmpdir, $basename); + open my $wfh, '>', $tmpfile or die $!; + print $wfh do { + my $src = do { + open my $rfh, '<', $_ or die $!; + my $s = do { local $/; <$rfh> }; + close $rfh; + $s; + }; + $src =~ s/Mouse::is_class_loaded/Class::MOP::is_class_loaded/g; + $src =~ s/Mouse/Moose/g; + $src; + }; + close $wfh; + }, + no_chdir => 1 }, + 't', ); }