From: Jarkko Hietaniemi Date: Sun, 20 Aug 2000 02:09:37 +0000 (+0000) Subject: Let's try #6717 again. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f826e675873869b37a797d26b1dd7ba9172dc5f4;p=p5sagit%2Fp5-mst-13.2.git Let's try #6717 again. p4raw-id: //depot/perl@6718 --- diff --git a/lib/File/Temp.pm b/lib/File/Temp.pm index 6fa58e3..e5b9982 100644 --- a/lib/File/Temp.pm +++ b/lib/File/Temp.pm @@ -384,7 +384,8 @@ sub _gettemp { # Attempt to open the file my $open_success = undef; - if ( $^O eq 'VMS' ) { # make it auto delete on close + if ( $^O eq 'VMS' and $options{"unlink_on_close"} ) { + # make it auto delete on close by setting FAB$V_DLT bit $fh = VMS::Stdio::vmssysopen($path, $OPENFLAGS, 0600, 'fop=dlt'); $open_success = $fh; } else { @@ -739,10 +740,6 @@ sub _can_do_level { # probably a better way to do this close($file->[0]); # file handle is [0] - # On VMS, the file will be automatically deleted on close, - # so we are through with the file already. - next if $^O eq 'VMS'; - if (-f $file->[1]) { # file name is [1] unlink $file->[1] or warn "Error removing ".$file->[1]; } @@ -885,9 +882,9 @@ sub tempfile { # Default options my %options = ( "DIR" => undef, # Directory prefix - "SUFFIX" => '', # Template suffix - "UNLINK" => 0, # Unlink file on exit - "OPEN" => 1, # Do not open file + "SUFFIX" => '', # Template suffix + "UNLINK" => 0, # Do not unlink file on exit + "OPEN" => 1, # Open file ); # Check to see whether we have an odd or even number of arguments @@ -904,6 +901,12 @@ sub tempfile { } + if ($options{"DIR"} and $^O eq 'VMS') { + + # on VMS turn []foo into [.foo] for concatenation + $options{"DIR"} = VMS::Filespec::vmspath($options{"DIR"}); + } + # Construct the template # Have a choice of trying to work around the mkstemp/mktemp/tmpnam etc @@ -942,6 +945,7 @@ sub tempfile { unless (($fh, $path) = _gettemp($template, "open" => $options{'OPEN'}, "mkdir"=> 0 , + "unlink_on_close" => $options{'UNLINK'}, "suffixlen" => length($options{'SUFFIX'}), ) );