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.
- dEvNuL
OS is FreeBSD 6.2, PERL is 5.8.8, if that matters
Here is code which reproduces this unwanted behavior:
use strict; use File::Temp q/tempfile/; for(my $i=0;$i<50;$i++) { my $tmp = new File::Temp('DIR' => '/tmp', 'UNLINK' => 1); sleep(1); }
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.
- dEvNuL
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File::Temp.. What am I missing?
by chromatic (Archbishop) on Sep 29, 2008 at 03:47 UTC | |
Re: File::Temp.. What am I missing?
by graff (Chancellor) on Sep 29, 2008 at 03:38 UTC | |
Re: File::Temp.. What am I missing?
by ikegami (Patriarch) on Sep 29, 2008 at 03:57 UTC |
Back to
Seekers of Perl Wisdom