- $self->{tmp_file_obj} = File::Temp->new(UNLINK => 1);
- $self->{tmp_file} = $self->{tmp_file_obj}->filename;
+ # Can't use the OO interface if we don't wan't the file to be opened by
+ # default, but then we have to deal with cleanup ourselves.
+ local $^W = 0;
+ (undef, my $tmp_file) = File::Temp::tempfile(
+ TEMPLATE => 'fakevgXXXX',
+ TMPDIR => 1,
+ CLEANUP => 0,
+ OPEN => 0,
+ );
+ $self->{tmp_file} = $tmp_file;