in reply to (OT) place on linux box to safely create tons of temp junk???

Whether or not any directories on the system have old files removed periodically depends on the system's configuration, or if you haven't configured it, its defaults. So the first thing to do is poke around inside your system's documentation and/or cron configuration and see if it's already cleaning anything. If not, set it up to automatically clean /tmp, then write your files there.

File::Temp is a useful way to create tempfiles, but you'll still have to figure out how to get them cleaned up.

Also, it's best if you can clean them up yourself, and only leave them lying around in the rare case that your program crashes. Things like END blocks are useful places for this sort of cleanup.

Replies are listed 'Best First'.
Re^2: (OT) place on linux box to safely create tons of temp junk???
by perrin (Chancellor) on Apr 03, 2006 at 03:17 UTC
    Actually, File::Temp will clean up after you if you want it to.
      Yes indeed, I didn't know that! Very handy. Not entirely foolproof, for example if your process crashes perl or is killed with SIGKILL, but probably close enough for most purposes.
Re^2: (OT) place on linux box to safely create tons of temp junk???
by leocharre (Priest) on Apr 04, 2006 at 17:05 UTC
    About cleaning them up myself.. I am creating some modules, and i have distribution in mind. I only trust people downloading and configuring so far- installing a module, and setting up a cron, may be too much to expect from some people.
      Then just let them configure where temp files go, defaulting to /tmp, try your best to clean them up when you exit, and document that some systems won't automatically clean that area, and on the rare occasion something goes Very Wrong, the user may need to clean it manually once in awhile, or set up a cronjob to do it automatically. That's really all you can do.