http://qs1969.pair.com?node_id=292667


in reply to Conflicting usage recommendations: File::Temp and File::Copy

Howdy!

File::Temp is about the secure creation of temp files. It gives you back a file handle to the opened file and the file name. If you depend solely on the file name, you could get burned; the file handle points to the actual file File::Temp created.

With File::Copy, you are normally going to be referencing files by name, so converting the name to a file handle carries different hazards.

Consider the two warnings in the context of their respective modules. They are not contradictory unless you remove them from their contexts.

yours,
Michael

  • Comment on Re: Conflicting usage recommendations: File::Temp and File::Copy

Replies are listed 'Best First'.
Re: Re: Conflicting usage recommendations: File::Temp and File::Copy
by kilinrax (Deacon) on Sep 19, 2003 at 15:45 UTC
    I fear you misinterpret my use of the word 'contadictory'. The warnings are contradictory merely in the context of attempting to use the modules together in the way I describe; under such circumstances you cannot heed both.
      Howdy!

      True...given your particular usage, you can't slavishly heed both, but you can make a mature decision which warning is superfluous in your specific situation. (did I use enough big words? :))

      yours,
      Michael

        ... which was the decision I was looking for advice on :)

        Though there doesn't seem to be a total consensus as to which way to call this; in light of people's resopnses, my instincts are inclining towards the usage of filenames.

        In fact, I am beginning to wonder if relying on POSIX functions is A Good Thing. Perhaps File::Temp::PurePerl might be a good idea?