Petr Vileta wrote:
>> I am looking for a way to programmatically get the list of file handles >>and their properties from inside my application. My application seems to >>be leaking file handles, so I would like to print them out periodically in >>an attempt to determine where the leak is. I have done the obvious of >>matching up the opens and closes but this has not turned anything up. >> >> The debugger is able to print them out, so I figure my app should be able >>to do it as well. >> > > The debuger is able to print out file handles because the debuger remeber > all file handle numbers ;-) > If you want to do something similar you must use some like this > > open(HANDLE1, ">some_file_or_pipe") or die "Can't open HANDLE1"; > ... > close(HANDLE1) or die "Can't close HANDLE1"; > > Instead of "die" you can use "print" if you can to continue program run. You could also call a subroutine to do your opens and closes and keep track of them that way. Write it to a log file when debugging is on. _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
