Setting this attribute to true will cause this method to not perform the typical double-fork, which is extra added protection from your process accidentally aquiring a controlling terminal. More information can be found above, and by Googling "double fork daemonize".

If you the double-fork behavior off, you might want to enable the ignore_zombies.

Setting this attribute to a true value will result in setting the $SIG{CHLD} handler to IGNORE. This tells perl to clean up zombie processes. By default, and for the most part you don't need it, only when you turn off the double fork behavior (with the no_double_fork attribute) do you sometimes want this behavior.

This forks off the child process to be daemonized. Just as with the built in fork, it returns the child pid to the parent process, 0 to the child process. It will also set the is_daemon flag appropriately.

The %options argument remains for backwards compatability, but it is suggested that you use the attributes listed above instead.

This behavior can be controlled slightly though the MX_DAEMON_STDERR and MX_DAEMON_STDOUT environment variables. It will look for a filename in either of these variables and redirect STDOUT and/or STDERR to those files. This is useful for debugging and/or testing purposes.

NOTE

If called from within the parent process (the is_daemon flag is set to false), this method will simply return and do nothing.

The first fork accomplishes two things - allow the shell to return,
and allow you to do a setsid().
The setsid() removes yourself from your controlling terminal. You
see, before, you were still listed as a job of your previous process,
and therefore the user might accidentally send you a signal. setsid()
gives you a new session, and removes the existing controlling terminal.
The problem is, you are now a session leader. As a session leader, if
you open a file descriptor that is a terminal, it will become your
controlling terminal (oops!). Therefore, the second fork makes you NOT
be a session leader. Only session leaders can acquire a controlling
terminal, so you can open up any file you wish without worrying that
it will make you a controlling terminal.
So - first fork - allow shell to return, and permit you to call setsid()
Second fork - prevent you from accidentally reacquiring a controlling
terminal.

That said, you don't always want this to be the behavior, so you are free to specify otherwise using the no_double_fork attribute.

Doing the double fork (see above) tends to get rid of your zombies since by the time you have double forked your daemon process is then owned by the init process. However, sometimes the double-fork is more than you really need, and you want to keep your daemon processes a little closer to you. In this case you have to watch out for zombies, you can avoid then by just setting the ignore_zombies attribute (see above).

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.