P is for Practical | |
PerlMonks |
Logging to a filehandle of a deleted fileby Marcello (Hermit) |
on Feb 28, 2007 at 09:28 UTC ( [id://602461]=perlquestion: print w/replies, xml ) | Need Help?? |
Marcello has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'm implementing a simple logging module for a project but ran into a problem which is probably easy to fix. I open a filehandle to the logfile which remains open until the long-running process ends. However, the logfile may be removed by another non-Perl process (so a file lock doesn't help here). After this happened, the printing to the filehandle still returns 1 but the file is not recreated again. Here's in short my problem: Is there a solution so I can detect that the file does not exists anymore? Both print and syswrite report no errors. Ofcourse I could use (-e $filename) but there's always this chance that the file is removed between the test and the print. I can use other logging modules out there, but prefer to use my own light-weight module for simple logging. Any help is as always appreciated! Cheers
Back to
Seekers of Perl Wisdom
|
|