Skip Menu |

This queue is for tickets about the File-Temp CPAN distribution.

Report information
The Basics
Id: 14151
Status: resolved
Priority: 0/
Queue: File-Temp

People
Owner: Nobody in particular
Requestors: bjoern [...] hoehrmann.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.16
Fixed in: (no value)



Subject: Sub-optimal error handling when out of file handles
On Windows Server 2003, using something like % perl -MFile::Temp -e "do { my $fh = File::Temp->new(); File::Temp::unlink0($fh, $fh->filename); } for 0..5000" does not give a meaningful error message (after creating about 2000 temp files it runs out of file handles); Carp.pm will try to load Carp::Heavy but can't because Perl ran out of file handles. I'm not sure whether this is worth fixing or whether File::Temp is the right module to address this though.
From: TJENNESS [...] cpan.org
On Sat Aug 13 20:07:51 2005, guest wrote: Show quoted text
> On Windows Server 2003, using something like > > % perl -MFile::Temp -e "do { my $fh = File::Temp->new(); > File::Temp::unlink0($fh, $fh->filename); } for 0..5000" > > does not give a meaningful error message (after creating about 2000 > temp files it runs out of file handles); Carp.pm will try to load > Carp::Heavy but can't because Perl ran out of file handles. I'm not > sure whether this is worth fixing or whether File::Temp is the > right module to address this though.
I can't test on Windows but what happens if you remove the explicit unlink0 call? The object destructor will close the file and cause and unlink to occur automatically each time round the loop. Calling unlink0 explicitly will cause the file to be added to the END block cleanup. I can simulate this behaviour on unix by triggering the deferred unlink case in unlink0. I get the Carp/Heavy error if I use unlink0 but everything works fine if I explicitly do not use unlink0.
I've adjusted things so you will now get the "out of file handles" error mesage. V0.17 is now on CPAN. Removing the unlink0 will also fix this.