perlquestion
kilinrax
<p>I have a script which uses [cpan://File::Temp] and [cpan://File::Copy] to create a temporary copy of a file to read from. The file in question is periodically rewritten by a Java process, and it's imperative that I get a complete version.
</p>
My concern is the conflicting warning regarding correct usage of the two modules.<br />
From <a href="http://search.cpan.org/author/JHI/perl-5.8.0/lib/File/Copy.pm#DESCRIPTION">File::Copy</a>:
<blockquote><strong>Note that passing in files as handles instead of names may lead to loss of information on some operating systems; it is recommended that you use file names whenever possible.</strong></blockquote>
And from <a href="http://search.cpan.org/author/JHI/perl-5.8.0/lib/File/Temp.pm#WARNING">File::Temp</a>:
<blockquote>For maximum security, endeavour always to avoid ever looking at, touching, or even imputing the existence of the filename. You do not know that that filename is connected to the same file as the handle you have, and attempts to check this can only trigger more race conditions. It's far more secure to use the filehandle alone and dispense with the filename altogether.</blockquote>
My question is; which of these warnings should take precedence? In this particular case, should I be using filehandles or names?
And more generally, how do you make judgement calls between conflicting usage warnings in situations like these?