in reply to Re: Re: thread:shared
in thread thread:shared

Yeah, I figured out that "no-echo-to-self" part myself, but even with your bug fix, there is no echo, at least on my machine. Linux with Perl5.8.0. Are you using a later Perl version, I know some of Liz's modules require 5.81. I still only get newlines echoed around. As a first guess, I'm thinking it has something to do with your extensive use of $1 and $2, and maybe they are "going out of scope"? I feel confident that I can narrow it down, since I can trace the newlines.

The bigger problem, which I see, is the way the server crashes when you close all clients, then restart them, and try to print something from client 1. It only affects client1.

I have found a fix for this, but it was just by my "intuitive guessing", so I can't say what overall effect it will have. But.......if you don't detach the reader and writer threads, the crash problem goes away.(as far as my limited testing has shown). So comment out:

# $r->detach(); # $w->detach();

Maybe that will help your problem. Thanks again for the code. This is the first threaded-chat code I could find.