diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-20 02:09:37 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-20 02:09:37 +0000 |
commit | f826e675873869b37a797d26b1dd7ba9172dc5f4 (patch) | |
tree | 4cfd32c47afe5047b28a67baf77459821493fc8c /lib | |
parent | b7450f5b3d7b729d33c4fb93c39ba7682081e96b (diff) | |
download | perl-f826e675873869b37a797d26b1dd7ba9172dc5f4.tar.gz |
Let's try #6717 again.
p4raw-id: //depot/perl@6718
Diffstat (limited to 'lib')
-rw-r--r-- | lib/File/Temp.pm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/File/Temp.pm b/lib/File/Temp.pm index 6fa58e3e19..e5b9982dce 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'}), ) ); |