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

I want to create a chatroom for my website that is written in Perl.

How do I write the code so that the chatroom only refreshes whenever someone types and submits something new to the room?

Currently, my chatroom refreshes every 15 seconds via a Javascript refresh, regardless of whether anything new is typed in the chatroom. Obviously this is a waste of server resources if someone walks away from their computer with the chatroom open.

Replies are listed 'Best First'.
Re: perl chatroom
by AK108 (Friar) on Mar 21, 2006 at 02:13 UTC
Re: perl chatroom
by merlyn (Sage) on Mar 21, 2006 at 02:15 UTC
      Thank you. This is the Perl script I am looking for.
      all you need to do is make the form that posts to the script. this will make the page refresh. you can also set the meta refresh so it mimics the same thing your javascript does. i hope that points you in the right direction
        Right, the chat window only needs to refresh whenever someone types and submits something.

        However, the chat window needs to refresh not only in the submitter's window, but in all the viewers' windows as well.

        Basically, I have to get two different instances of the same Perl script to talk to each other.

        I know this is possible in php. There are numerous php chat clients in which scripts talk to each other, only refreshing the chat window when necessary.

        Is this possible in perl? Or is this a discovery in which php beats perl?