Из perldoc Apache:
$c = $r->connection
The $r->connection method will return a reference to the request
connection object (blessed into the Apache::Connection package).
This is really a "conn_rec*" in disguise. The following methods
can be used on the connection object:
$c->fileno( [$direction] )
Returns the client file descriptor. If $direction is 0, the
input fd is returned. If $direction is not null or ommitted,
the output fd is returned.
This can be used to detect client disconnect without doing any
I/O, e.g. using IO::Select.
Не подойдет ?