iic has asked for the wisdom of the Perl Monks concerning the following question:

HI, I have visited many chatrooms on a specified port(such as 8000).But I have never seen their source codes. Recently,I want to build my chatroom like them with Perl. I can code Socket with Perl and kown some about HTTP.My idea is:accept requests and save these Sockets in a Handles -Hash.When sb. want to say to others,I print his saying to every handles in the Handles-Hash.I set $SIG{PIPE}='IGNORE' ,so that when "print SOCKET" return false or undef I can say the user has gone and delete the user in User-Hash. I have no experience on this matter.Is my idea wrong? I hope I can get some advices from you. Many Thanks.

Replies are listed 'Best First'.
Re: My simple idea.
by chromatic (Archbishop) on Jul 24, 2000 at 06:28 UTC
    merlyn did something similar in his Web Techniques column a couple of years ago. See columns 23 and 24 for more details.

    Basically, he uses the HTTP::Daemon module from LWP, spawns off a new server for each connection, and redirects to the new port. Pretty ingenious technique, and a lot easier than using IO::Socket calls. (Trust me on this.)

Re: My simple idea.
by cwest (Friar) on Jul 23, 2000 at 22:00 UTC
    I belive there is a great example of doing something similar at Web Monkey. They have a whole tutorial on writing the client and the server, it's pretty cool.

    Check it out

    --
    Casey