|Do you know where your variables are?|
Fork issuesby 3SRT (Novice)
|on Feb 12, 2008 at 21:28 UTC||Need Help??|
3SRT has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow monks,
I created a simple 'server' script that will accept input from a cgi script. The server will handle multiple connections on the same port, also. In a nut shell, this 'server' script will take in variables, and fork off a process to sleep for a given amount of time, and then send the user an email (and perform other functions).
Here is my problem: I receive a confirmation e-mail once the connection has been made, but i do not receive the other e-mail (which is supposed to be sent from the forked process once the sleep() is up). I receive one confirmation e-mail per client, but I will never receive the second e-mail. I don't know why the forked process is not working as I think it should?
Also, the problem ONLY happens when I daemonize the process. If i simply run the script inside a terminal 'perl server.pl', it will work perfectly fine and I will get all the desired results. However, when I daemonize it by 'perl server.pl &', the functions within the fork, including the second e-mail, will not be executed.
Shouldn't I be able to daemonize it and get the same results?
Here is the code:
Thanks in advance!