Take a look at select, IO::Select, PerlIPC.
In reply to Re: Check connection state prior to send data by BrowserUk in thread Check connection state prior to send data by Lucas Rey