diff --git a/mvwrap/mvwrap b/mvwrap/mvwrap index 2973562..935ccd0 100755 --- a/mvwrap/mvwrap +++ b/mvwrap/mvwrap @@ -3,7 +3,7 @@ # $Id$ # -# Copyright (c) 2001 - 2007 Ward Wouts +# Copyright (c) 2001 - 2013 Ward Wouts # # 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";