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.
In reply to Re: Fork parent process dies unexpectedly
by Animator
in thread Fork parent process dies unexpectedly
by iang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |