NAME
Plack::Middleware::SubSpec::Command::call - Handle 'call' command (call subroutine and return the result)
VERSION
version 0.06
SYNOPSIS
# in your app.psgi
use Plack::Builder;
builder {
# enable other middlewares ...
enable "SubSpec::Command::call";
# enable other middlewares ...
};
DESCRIPTION
This middleware uses Sub::Spec::Caller to call the requested subroutine and format its result. Will return error 500 will be returned if requested output format is unknown/unallowed.
CONFIGURATIONS
default_output_format => STR ('json'|'yaml'|'php'), default 'json'
The default format to use if client does not specify 'output_format' request option.
If unspecified, some detection logic will be done to determine default format: if client is a GUI browser, 'html'; otherwise, 'json'.
allow_return_json => BOOL (default 1)
Whether we should comply when client requests JSON-encoded return data.
allow_return_yaml => BOOL (default 1)
Whether we should comply when client requests YAML-encoded return data.
allow_return_php => BOOL (default 1)
Whether we should comply when client requests PHP serialization-encoded return data.
time_limit => INT | CODE
Impose time limit, using alarm(). If coderef is given, it will be called for every request with ($self, $env) argument and expected to return the time limit.
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.