From: Jarkko Hietaniemi Date: Tue, 26 Jun 2001 13:50:53 +0000 (+0000) Subject: Be more portable in the quest for tmpdir. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dfefebdc4b8b0287c53bf794034447d3245eaf00;p=p5sagit%2Fp5-mst-13.2.git Be more portable in the quest for tmpdir. p4raw-id: //depot/perl@10963 --- diff --git a/lib/Memoize/t/tie.t b/lib/Memoize/t/tie.t index c006aac..c7083c5 100755 --- a/lib/Memoize/t/tie.t +++ b/lib/Memoize/t/tie.t @@ -23,11 +23,12 @@ sub n { $_[0]+1; } -$tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp'; if (eval {require File::Spec::Functions}) { - File::Spec::Functions->import(); + File::Spec::Functions->import('tmpdir'); + $tmpdir = tmpdir(); } else { *catfile = sub { join '/', @_ }; + $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp'; } $file = catfile($tmpdir, "md$$"); @files = ($file, "$file.db", "$file.dir", "$file.pag"); diff --git a/lib/Memoize/t/tie_sdbm.t b/lib/Memoize/t/tie_sdbm.t index 1a5a392..51bd403 100644 --- a/lib/Memoize/t/tie_sdbm.t +++ b/lib/Memoize/t/tie_sdbm.t @@ -29,11 +29,12 @@ if ($@) { print "1..4\n"; if (eval {require File::Spec::Functions}) { - File::Spec::Functions->import(); + File::Spec::Functions->import('tmpdir'); + $tmpdir = tmpdir(); } else { - *catfile = sub { join '/', @_ }; + *catfile = sub { join '/', @_ }; + $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp'; } -$tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp'; $file = catfile($tmpdir, "md$$"); 1 while unlink $file, "$file.dir", "$file.pag"; tryout('Memoize::SDBM_File', $file, 1); # Test 1..4