Hi Tim, It would be nice to support the TMPDIR option for File::Temp::tempfile, for consistency with tempdir.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=351373 I've appended a simple patch (a cut-n-paste from tempdir) to fix this. You may want to consider re-factoring the argument parsing and template construction into a seperate subroutine. --bod --- File/Temp.pm.orig 2006-02-10 08:05:44.000000000 +1100 +++ File/Temp.pm 2006-02-14 00:58:57.000000000 +1100 @@ -1198,7 +1198,8 @@ # Default options my %options = ( - "DIR" => undef, # Directory prefix + "DIR" => undef, # Directory prefix + "TMPDIR" => 0, # Use tempdir with template "SUFFIX" => '', # Template suffix "UNLINK" => 0, # Do not unlink file on exit "OPEN" => 1, # Open file @@ -1233,9 +1234,30 @@ # First generate a template if not defined and prefix the directory # If no template must prefix the temp directory if (defined $template) { - if ($options{"DIR"}) { - $template = File::Spec->catfile($options{"DIR"}, $template); + # Need to strip directory path if using DIR or TMPDIR + if ($options{'TMPDIR'} || $options{'DIR'}) { + + # Strip parent directory from the filename + # + # There is no filename at the end + $template = VMS::Filespec::vmspath($template) if $^O eq 'VMS'; + my ($volume, $directories, undef) = File::Spec->splitpath( $template, 1); + + # Last directory is then our template + $template = (File::Spec->splitdir($directories))[-1]; + + # Prepend the supplied directory or temp dir + if ($options{"DIR"}) { + + $template = File::Spec->catdir($options{"DIR"}, $template); + + } elsif ($options{TMPDIR}) { + + # Prepend tmpdir + $template = File::Spec->catdir(File::Spec->tmpdir, $template); + + } } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

