On Tue, Nov 02, 2010 at 09:59:12PM -0400, Uri Guttman wrote: > why are you concerned about closing the DATA handle? it is internal to > the program. actually it is the handle the perl binary uses to read the > source file and it is left at the seek point where the DATA starts.
Because, I understand it to be best practice to close all file handles, as per: http://www.webreference.com/perl/tutorial/9/2.html "Besides closing any filehandles that might have been opened ..." http://en.wikipedia.org/wiki/Daemon_%28computer_software%29 "Closing all inherited open files at the time of execution that are left open by the parent process, ..." http://www.enderunix.org/docs/eng/daemon.php "Unneccesarry [sic] descriptors should be closed before fork() system call (so that they are not inherited) or close all open descriptors as soon as the child process starts running." I also have here in the office a copy of Steven's Unix Network programming Volume 1, 2nd edition. Chapter 12 (Daemon Processes and inetd SuperServer) describes daemonizing a process; his example code lib/daemon_init.c also pointedly closes all file handles; review that source here: http://www.kohala.com/start/unpv12e/unpv12e.tar.gz I'm maintaining a perl module (internally) that allows for convienent daemonizing; I wrote it to be as 'correct' as possible. Until yesterday, I didn't realize that DATA and END were magic file descriptors in perl. As such, it would be easy to alter my module to preserve them. If I can find reference to other magic descriptors, then I'll take them into account as well. > well, perl keeps it open so it can be used by anyone reading from > DATA. If it keeps it open (despite my closing the file descriptor), then why does the daemonized process no longer have access to all of it's contents? > this list (as most other rightly do) filters out attachments. so you > should just paste your code in the email instead. That does make sense; I'll re-post soonish... Thanks for the feedback... > uri > > -- > Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- > ----- Perl Code Review , Architecture, Development, Training, Support ------ > --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- Brian Reichert <reich...@numachi.com> 55 Crystal Ave. #286 Derry NH 03038-1725 USA BSD admin/developer at large _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm