in reply to How to make sysread timeout

Typically you would use select (if you follow the link, you want the 4-arg version of select) or IO::Select to handle the timeout.