You've had two recommendations for File::Temp. Consider this a third - I use tempfiles in the test suites for DBM::Deep, PDF::Template, and Excel::Template. The common denominator is that I have a t/common.pm which manages the creation and destruction. You will probably want something similar.
My criteria for good software:
Does it work?
Can someone else come in, make a change, and be reasonably certain no bugs were introduced?