Mailing List Archive

Client Disconnect Behavior and Detection
Having a problem with trying to stop further execution of actions in a
controller when the client has disconnected from the server.

I am using XML::Writer in a controller to write directly to the response
object, treating as a file handle. The basic setup is as follows:

my $writer = XML::Writer->new(
OUTPUT => $c->response,
DATA_INDENT => 2,
DATA_MODE => 1,
CHECK_PRINT => 1
);

Which all works fine as resulting code outputs to the $writer this is
fed through the response.

Thing is, as this is generally a lengthy streaming process, if the
client was to disconnect the process continues to run, which is not
desirable. From the XML::Writer documentation, the option has been set
on this instance to CHECK_PRINT, meaning if a write to the file handle
were to fail then an error would be thrown, from which further
processing can be safely shut down.

But the problem here is from the Writer's point of view there is nothing
wrong with the file handle (response) even though the client has
disconnected.

Whose responsibility is this? Engine or Framework? Does anyone know of a
reliable way in which the client hang-up can be detected and where to
look where this should be happening.

Neil

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/