diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-26 13:50:53 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-26 13:50:53 +0000 |
commit | dfefebdc4b8b0287c53bf794034447d3245eaf00 (patch) | |
tree | 69923f422e4274706d06d0fe305e2867d0c4a0ac /lib/Memoize | |
parent | b27238ebb2d98f4c4edac4b768c952eb91ee2c3a (diff) | |
download | perl-dfefebdc4b8b0287c53bf794034447d3245eaf00.tar.gz |
Be more portable in the quest for tmpdir.
p4raw-id: //depot/perl@10963
Diffstat (limited to 'lib/Memoize')
-rwxr-xr-x | lib/Memoize/t/tie.t | 5 | ||||
-rw-r--r-- | lib/Memoize/t/tie_sdbm.t | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/Memoize/t/tie.t b/lib/Memoize/t/tie.t index c006aacca6..c7083c5fd6 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 1a5a392240..51bd403394 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 |