Plack::Middleware::Recorder - Plack middleware that records your client-server interactions
version 0.06
use Plack::Builder; builder { enable 'Recorder', output => 'requests.out', # required active => 1, # optional start_url => '/recorder/start', # optional stop_url => '/recorder/stop'; # optional $app; };
This middleware records the stream of requests and responses that your application goes through to a file. The middleware records all requests while active; the active state can be altered via "start_url" and "stop_url"".
Either a filename, a glob reference, or an IO::Handle where the serialized requests will be written to. To read these requests, use Plack::VCR.
Whether or not to start recording once the application starts. Defaults to 1.
A relative URL that will tell the recorder middleware to record subsequent requests if requested. Defaults to '/recorder/start'.
A relative URL that will tell the recorder middleware to stop recording requests. Defaults to '/recorder/stop'.
This module was written to scratch a fairly specific itch of mine, but one I encounter often. I work on a lot of Javascript-heavy web applications for my job, and I often have to fix bugs that only rear their ugly heads a dozen clicks or so into the application. Obviously, if the bug is in the Javascript, there's not much I can do about it, but often the problem comes from the output I receive from the server. This middleware allows me to set up debugging statements in the server and replay the requests the frontend is submitting to get me on the right track.
The first release of this distribution was fairly simple; it only records and retrieves requests. In the future, I'd like a bunch of features to be added:
Recording responses could be useful for generating test scripts and the like.
On that note, a script/convenience module for generating test scripts would be nice.
Currently, authorization works by just copying headers blindly. This logic could be improved with application-specific hooks.
Request bodies are recorded directly in the output stream, and an in-memory representation is used for psgi.input. This could be better.
CatalystX::Test::Recorder, https://github.com/miyagawa/Plack-Middleware-Test-Recorder, Plack::VCR
Rob Hoelz <rob@hoelz.ro>
This software is copyright (c) 2015 by Rob Hoelz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Please report any bugs or feature requests on the bugtracker website https://github.com/hoelzro/plack-middleware-recorder/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
To install Plack::Middleware::Recorder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::Recorder
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::Recorder
For more information on module installation, please visit the detailed CPAN module installation guide.