How Does One Implement a Timer in Perl?

How Does One Implement a Timer in Perl?

am 06.11.2007 18:51:05 von kvnsmnsn

I need to write a Perl script for one server that sends off messages
on a socket and then waits for a response. If a response comes in
five seconds, it uses that response for its output. If a response
_doesn't_ come in five seconds, it uses another algorithm to generate
its output.

Is there a way in Perl to do this, to suspend execution until five
seconds have past or until a response has come, whichever happens
first? Any feedback on this would be greatly appreciated.

---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_