|There's more than one way to do things|
File::Temp.. What am I missing?by devnul (Monk)
|on Sep 28, 2008 at 22:52 UTC||Need Help??|
devnul has asked for the
wisdom of the Perl Monks concerning the following question:
Pulling another all-nighter and am gettin' some unwanted behavior from File::Temp.. Anyone know what I'm missing?
OS is FreeBSD 6.2, PERL is 5.8.8, if that matters
Here is code which reproduces this unwanted behavior:
What is going on is that as this script runs I can run "ls -l /tmp" and see the files being created and destroyed. But as soon as I hit ctrl-C to quit, the last temp file it created is still hanging around (otherwise known as the "unwanted behavior").
I would note that removing 'UNLINK' => 1 from the constructor, or using the my ($fh, $filename) = tempname('DIR' => '/tmp', 'UNLINK' => 1); produces the same result. The only reason I changed it from that was in an attempt to debug what is going on.