NAME

Plack::Middleware::Debugger::Collector - Middleware for collecting debugging data

VERSION

version 0.03

DESCRIPTION

This middleware orchestrates the interaction between the Plack::Debugger instance and the current request. It sets up the debugger to record the request, fires the begin phase and then calls the PSGI application it wraps. It then goes about calling the after phase using the response_cb callback. If the current request supports the psgix.cleanup extension it will setup things so that the cleanup phase of the debugger can be run followed by the finalization of the debugger session. If psgix.cleanup is not supported it will call the finalization code immediately after the after phase.

METHODS

new (%args)

This expects a debugger key which contains an instance of the Plack::Debugger.

debugger

This is just an accessor for the debugger specified in the contstructor.

call ($env)

This is just the overriden call method from Plack::Middleware.

initialize_request ($env)

This just delegates to the Plack::Debugger method of the same name.

finalize_request ($env)

This just delegates to the Plack::Debugger method of the same name.

setup_before_phase ($env)

This just sets up the before phase, which basically just calls the initialize_request method, followed by the run_before_phase method.

run_before_phase ($env)

This just delegates to the Plack::Debugger method of the same name.

setup_after_phase ($env, $resp)

This just sets up the after phase, which basically just returns a callback suitable for passing into response_cb. The callback then just calls the run_after_phase method.

run_after_phase ($env, $resp)

This just delegates to the Plack::Debugger method of the same name, and then calls finalize_request if there is no support for the psgi.cleanup extension.

setup_cleanup_phase ($env)

This just sets up the cleanup phase, which basically just pushes a callback in the psgi.cleanup.handlers array, that will call the run_cleanup_phase method. Of course it only does this if we have support for the psgi.cleanup extension.

run_cleanup_phase ($env)

This just delegates to the Plack::Debugger method of the same name, and then calls finalize_request.

ACKNOWLEDGMENT

This module was originally developed for Booking.com. With approval from Booking.com, this module was generalized and published on CPAN, for which the authors would like to express their gratitude.

AUTHOR

Stevan Little <stevan@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Stevan Little.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.