jdrago_999 has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I was recently bit by the "Too many open files" error while doing a lot of file operations via a Perl script.
After (several hundred or thousand) file handles had been opened (and not closed), my program would just crash.
Sure - now I've fixed the problem, but it would be nice to add a unit test to check for dangling open file handles. A quick search on CPAN didn't produce anything, and without resorting to tricks like $open_filehandles = `/usr/sbin/lsof -p $$ | wc -l` I'd like to know how to do this in Perl.
Ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to test for open file handles?
by repellent (Priest) on Feb 04, 2009 at 05:31 UTC | |
by mikegrb (Initiate) on Feb 04, 2009 at 14:21 UTC | |
|
Re: How to test for open file handles?
by roboticus (Chancellor) on Feb 04, 2009 at 00:36 UTC | |
by jdrago_999 (Hermit) on Feb 04, 2009 at 01:40 UTC | |
|
Re: How to test for open file handles?
by Joost (Canon) on Feb 04, 2009 at 01:28 UTC | |
by Anonymous Monk on Feb 04, 2009 at 02:18 UTC | |
|
Re: How to test for open file handles?
by kyle (Abbot) on Feb 04, 2009 at 05:29 UTC | |
|
Re: How to test for open file handles?
by NateTut (Deacon) on Feb 04, 2009 at 15:25 UTC |