Why not adopt me?
NAME
Plack::Middleware::Recorder - Plack middleware that records your client-server interactions
VERSION
version 0.02
SYNOPSIS
use Plack::Builder;
builder {
enable 'Recorder',
output => 'requests.out', # required
active => 1, # optional
start_url => '/recorder/start', # optional
stop_url => '/recorder/stop'; # optional
$app;
};
DESCRIPTION
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"".
OPTIONS
output
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.
active
Whether or not to start recording once the application starts. Defaults to 1.
start_url
A relative URL that will tell the recorder middleware to record subsequent requests if requested. Defaults to '/recorder/start'.
stop_url
A relative URL that will tell the recorder middleware to stop recording requests. Defaults to '/recorder/stop'.
RATIONALE
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.
FURTHER IMPROVEMENTS
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:
Specifying the output as a filename doesn't work properly with CGI (the middleware clobbers the output file)
The middleware probably won't function correctly in a concurrent environment like Starman.
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.
Others
SEE ALSO
CatalystX::Test::Recorder, https://github.com/miyagawa/Plack-Middleware-Test-Recorder, Plack::VCR
AUTHOR
Rob Hoelz <rob@hoelz.ro>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 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.
BUGS
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.