in reply to It works, and then it doesn't...connecting to a daemon over the net
The code: exec() unless fork() is not robust. If fork() fails, it returns undef. In this case your code is going to do an exec in the main process and not give an error. You really shouldn't try to write a one-liner here because there are three cases (1) parent (2) child (3) fork failed.
One general-purpose debugging technique:
If you look at the times, you can see where your program is waiting. Scatter these liberally through your program. You may be surprised.# do this once (obviously, I hope) use IO::File; open LOG, ">>log.out" or die "opening log.out: $!\n"; LOG->autoflush(1); printf LOG "PROC $$: %d %s run starts %s\n", time, __FILE__, scalar(localtime); # put lots of these throughout your program printf LOG "PROC $$: %d %s(%d)\n", time, __FILE__, __LINE__;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: It works, and then it doesn't...connecting to a daemon over the net
by seaver (Pilgrim) on Jun 12, 2003 at 21:23 UTC | |
|
Re: Re: It works, and then it doesn't...connecting to a daemon over the net
by seaver (Pilgrim) on Jun 18, 2003 at 17:07 UTC |