Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Client Disconnect Behavior and Detection

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


neil at mylunn

Jul 12, 2012, 9:58 PM

Post #1 of 1 (223 views)
Permalink
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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.