neil at mylunn
Jul 12, 2012, 9:58 PM
Post #1 of 1
Having a problem with trying to stop further execution of actions in a
Client Disconnect Behavior and Detection
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
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.
List: Catalyst [at] lists
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/