On Wed, May 01, 2002 at 03:23:24AM -0400, Peter Chen wrote: > On Wed, 2002-05-01 at 03:05, Andrew A. Chen wrote: > > I am unsure how kosher this solution is, but it's "functional" as far as I > > know. I jacked the daemonize() routine out of perlfaq and called it just > > before $poe_kernel->run(); See below.
[...] > Net::Server::Daemonize seems to take a more rigorous approach. > > What I am tripping over is whether it makes sense to daemonize within > POE's event loop instead, and whether that would cause any adverse > effects. > > For example, let's say I like to use POE::Component::Logger and I would > like to keep the logging API consistent. In this case, it seems to > require me to enter POE's event loop as soon as possible, and having a > session do the initialization work and possibly log errors. Daemonizing with fork and exit shouldn't matter to POE. However, you run into a problem where object destruction in the parent process may clean up resources that the child is still using. Consider an object that locks and opens a device. On destruction, it may unlock and reset the device's modes to sane values. If that happens in the parent, the child may have problems. POE does most of its self-destruction through explicit reference counts, not Perl's, so exiting early shouldn't affect much. If I turn out to be wrong, maybe we can do something about it. -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net
