iets veiligere creatie van tijdelijke bestanden
This commit is contained in:
parent
e8c8a098cd
commit
df843589c0
1 changed files with 5 additions and 4 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# $Id$
|
||||
|
||||
#
|
||||
# Copyright (c) 2001 - 2007 Ward Wouts <ward@wouts.nl>
|
||||
# Copyright (c) 2001 - 2013 Ward Wouts <ward@wouts.nl>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -23,9 +23,10 @@
|
|||
# Much easier than doing 6000 moves by hand
|
||||
#
|
||||
|
||||
require File::Temp;
|
||||
use File::Temp qw(tempfile);
|
||||
use IO::File;
|
||||
use File::Copy;
|
||||
use POSIX qw(tmpnam);
|
||||
use Getopt::Long;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
|
@ -77,8 +78,8 @@ sub edit($) {
|
|||
sub open_temp {
|
||||
my $target;
|
||||
my $target_name;
|
||||
do { $target_name = tmpnam() }
|
||||
until $target = IO::File->new($target_name, O_RDWR|O_CREAT|O_EXCL);
|
||||
($target, $target_name) = tempfile( TEMPLATE => 'MVWXXXXXXX', SUFFIX => '.mvwrap');
|
||||
# Volgende regel werkt niet...
|
||||
END { if ($opt_e) { unlink($target_name) or die("Couldn't unlink $target_name: $!");} }
|
||||
foreach (@source) {
|
||||
print $target "$_\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue