AxKit2

 view release on metacpan or  search on metacpan

lib/AxKit2/Plugin.pm  view on Meta::CPAN

Return Values - see L</uri_translation> above.


=head2 authentication

Params: HEADERS

Return Values - see L</uri_translation> above.


=head2 authorization

Params: HEADERS

Return Values - see L</uri_translation> above.


=head2 fixup

Params: HEADERS

Return Values - see L</uri_translation> above.


=head2 xmlresponse

Params: PROCESSOR, HEADERS

If this URI is to be treated as an XML request, this hook is for you. Passed an
C<AxKit2::Processor> object and the headers.

Return Value:

=over 4

=item * C<DECLINED> - Not treated as XML. Proceed to regular response hook.

=item * C<OK> [, C<PROCESSOR>]

XML Processed. If provided with a C<PROCESSOR> runs
C<< PROCESSOR->output() >> which in the normal case causes the HTML or
XML to be output to the browser. Stops processing the request at this point.

=item * C<DONE> - Output has been sent to the browser. Stop processing.

=item * Anything Else - send the appropriate error response to the browser.

=back


=head2 response

Params: HEADERS

Main response phase. Used for sending normal responses to the client.

Return Value:

=over 4

=item * C<DECLINED> - Sends a 404 response to the browser.

=item * C<OK> or C<DONE> - Stops processing this request. Response has been
sent.

=item * Anything Else - send the appropriate error response to the browser.

=back


=head2 response_sent

Params: CODE

Called after the response has been sent to the browser. The parameter is the
response code used (e.g. 200 for OK, 404 for Not Found, etc).

The return codes for this hook are used to determine if the connection should
be kept open in a keep-alive request.

Return Value:

=over 4

=item * C<DECLINED/OK> - Use default keep-alive response depending on request
type.

=item * C<DONE> - Request was OK, but don't keep the connection open.

=item * Anything Else - ... TBD.

=back


=head2 disconnect

TBD

=head2 error

Params: ERROR

Called whenever a hook C<die()>s or returns C<SERVER_ERROR>.

Return Value:

=over 4

=item * C<DECLINED> - Use default error handler

=item * C<OK/DONE> - Error was sent to browser. Ignore.

=item * Anything Else - Send a different error to the browser.

=back


=head1 CONTINUATIONS

AxKit2 is entirely single threaded, and so it is important not to do things that
take significant runtime away from the main event loop. A simple example of this
might be looking up a request on a remote web server - while the AxKit process
waits for the response it is important to allow AxKit to continue on processing
other requests.

In order to achieve this AxKit2 uses a simplified version of a technique known
in computer science terms as a I<continuation>.

In simple english, this is a way to suspend execution of one request and
I<continue> it at an arbitrary later time.

AxKit2 has a form of continuations based on the core event loop. Some hooks can
suspend execution by returning C<CONTINUATION>, and have execution of the
request continue when some event has occured.

A typical usage of this is when you need to perform an action that may take some



( run in 0.879 second using v1.01-cache-2.11-cpan-39bf76dae61 )