Subject: | Wishlist: Tempdirs that get deleted at end of a block |
(Excerpted from my review of File::Temp on cpanratings.org.) Having used File::Temp's object-oriented interface and gotten accustomed to having my tempfiles be deleted when the object goes out of scope, I long for the same facility with respect to tempdirs. As of v0.16, 'tempdir' is available only through the functional interface and you must explicitly call CLEANUP => 1 to get the tempdirs so created deleted at the end of the *program*. I would love to have a function/method that automatically deletes tempdirs at the end of their *enclosing scope/block*. This would, for example, enable me to create a tempdir within a block, test for its existence, have the tempdir deleted automatically when the block is closed, then test again for its non-existence. AFAICT, I can not currently run that second test because any tempdir I create lives until the end of the test program.