From: Tokuhiro Matsuno Date: Thu, 2 Apr 2009 03:49:29 +0000 (+0900) Subject: less deps in Makefile.PL X-Git-Tag: 0.20~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=98bbe659842bc1f47cce1f3a566f1738d477bcc0 less deps in Makefile.PL --- diff --git a/Makefile.PL b/Makefile.PL index c694d47..095fb2e 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -29,8 +29,9 @@ 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 +52,36 @@ 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::make_path($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/Moose/g; + $src; + }; + close $wfh; + }, + no_chdir => 1 }, + 't', ); } diff --git a/t/030_roles/failing/001_meta_role.t b/t/030_roles/failing/001_meta_role.t index 8db3590..940d719 100755 --- a/t/030_roles/failing/001_meta_role.t +++ b/t/030_roles/failing/001_meta_role.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 27; +use Test::More tests => 25; use Test::Exception; use Mouse::Meta::Role;