| vidals 2008-04-02, 9:12 am |
| Does anyone have experience with POE::Component::Server::SimpleHTTP?
I need help in understanding how to flush my response immediately upon
calling $_[KERNEL]->call( 'HTTPD', 'DONE', $response );
Here are the two lines in question taken from my "sub GOT_REQ":
$_[KERNEL]->call( 'HTTPD', 'DONE',
$response );
$_[KERNEL]->post( 'PROCESS_XML',
'create_xml_response', $nf, $xml_request );
I need the "call" to occur immediately and send a 0 (ok) or 1 (error)
to the client. AND THEN AFTER continue to process the xml request in
another session called PROCESS_XML. However, the 0 or 1 is *not* being
sent out to the client until after the PROCESS_XML session finishes,
which can take more than a minute. Why doesn't call('HTTPD'...) output
right away?
Any help would be greatly appreciated.
sub GOT_REQ {
# ARG0 = HTTP::Request object, ARG1 = HTTP::Response
object, ARG2 = the DIR that matched
my( $request, $response, $dirmatch ) = @_[ ARG0 ..
ARG2 ];
$response->code( 200 );
my $xml_request =
&retrieve_multipart_content($request, $response);
my $nf = &parse_content( $xml_request );
$response->content( $nf->{ReturnCode} );
# We are done! For speed, you could use $_[KERNEL]-
>call( ... )
$_[KERNEL]->call( 'HTTPD', 'DONE',
$response );
$_[KERNEL]->post( 'PROCESS_XML',
'create_xml_response', $nf, $xml_request );
}
Gil Vidals
|