16 use File::Temp qw( tempfile tempdir );
17 use Fcntl qw( :flock );
19 my $parent = $ENV{WORK_DIR} || File::Spec->tmpdir;
20 my $dir = tempdir( CLEANUP => 1, DIR => $parent );
23 my ($fh, $filename) = tempfile( 'tmpXXXX', DIR => $dir );
25 # This is because tempfile() returns a flock'ed $fh on MacOSX.
28 return ($fh, $filename);