From: Graham Knop Date: Tue, 21 Jul 2015 11:26:39 +0000 (-0400) Subject: clean up temp usage in pack test X-Git-Tag: v0.010005~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e43a039789413887ab1c472762db2f6e576f7fac;p=p5sagit%2FApp-FatPacker.git clean up temp usage in pack test --- diff --git a/t/pack.t b/t/pack.t index 16bc91a..55e5104 100644 --- a/t/pack.t +++ b/t/pack.t @@ -11,18 +11,22 @@ use Cwd; use App::FatPacker; my $keep = $ENV{'FATPACKER_KEEP_TESTDIR'}; -my $tempdir = tempdir($keep ? (CLEANUP => 0) : (CLEANUP => 1)); + +my $cwd = getcwd; +my $tempdir = tempdir('fatpacker-XXXXX', DIR => "$cwd/t", $keep ? (CLEANUP => 0) : (CLEANUP => 1)); mkpath([<$tempdir/{lib,fatlib}/t/mod>]); for() { copy $_, "$tempdir/lib/$_" or die "copy failed: $!"; } -my $cwd = getcwd; chdir $tempdir; my $fp = App::FatPacker->new; -my $temp_fh = File::Temp->new; +my $packed_file = "$tempdir/script"; +open my $temp_fh, '>', $packed_file + or die "can't write to $packed_file: $!"; + select $temp_fh; $fp->script_command_file; print "1;\n"; @@ -33,7 +37,7 @@ close $temp_fh; chdir File::Spec->tmpdir; # Packed, now try using it: -require $temp_fh; +require $packed_file; { require t::mod::a;