X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile.PL;h=095fb2ed0ac2affe3cf47eb42ccdee3b90217bd7;hb=240454c2be91b83fd7b265e598c284f7ea6ffce7;hp=c694d47b87386b40daaf7076a83c51a893991555;hpb=314fe3048f1aa8eb5d77b32040b4355b19a0c676;p=gitmo%2FMouse.git 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', ); }