How can I asynchronously monitor a file in Perl?
- by Hussain
I am wondering if it is possible, and if so how, one could create a perl script that constantly monitors a file/db, and then call a subroutine to perform text processing if the file is changed. I'm pretty sure this would be possible using sockets, but this needs to be used for a webchat application on a site running on a shared host, and I'm not so sure sockets would be allowed on it.
The basic idea is:
create a listener for a chat file/database
when the file is updated with a new message, call a subroutine
the called subroutine will send the new message back to the browser to be displayed
Thanks in advance.