in reply to Fork parent process dies unexpectedly
My first questions: you are aware of IO::Select and/or select? (You don't need to fork to be able to use/process more then one client connection.)
There certainly are some issues with this code, but none seem to be critical for the code (as in it's still broken)...
First note: on v5.6.1 the parent does not die. on v5.8.7 (and v5.9.2) the parent does die.
Second: in both programs you are missing: use warnings;. If you are using warnings then you will see one thing in the code: use of uninitalised value in numer gt. Why? Because you have: while (my $kid > 0). Creating a value, not assigning anything to it and then comparing it with 0 is silly. Also note that your while-loop does not assign anything to $kid. (Meaning you should do something more then just removing the my).
Then the client: it's missing use strict; and use warnings;. use warnings is important in this case if you are using it on v5.6.1 (as I initialy was). Why? Because it doesn't work. It seems that <$socket> only works if $socket is a lexical variable (again, on v5.6.1). And that's not the case.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Fork parent process dies unexpectedly
by Anonymous Monk on Nov 19, 2005 at 13:42 UTC | |
by thospel (Hermit) on Nov 19, 2005 at 16:17 UTC | |
by iang (Sexton) on Nov 19, 2005 at 19:36 UTC | |
by thospel (Hermit) on Nov 19, 2005 at 22:46 UTC |