NAME

Plack::Middleware::SubSpec::HandleCommand - Handle command

VERSION

version 0.10

SYNOPSIS

# in your app.psgi
use Plack::Builder;

builder {
    enable "SubSpec::HandleCommand";
};

DESCRIPTION

This module executes command specified in $env->{"ss.request"}{command} by calling handle_<cmdname>() in Sub::Spec::HTTP::Server::Command::<cmdname>. The result is then put in $env->{"ss.request"}{response}.

CONFIGURATIONS

  • default_output_format => STR, default 'json'

    The default format to use if client does not specify 'output_format' SS request key.

    If unspecified, some detection logic will be done to determine default format: if client is a GUI browser, 'html'; otherwise, 'json'.

  • allowed_output_formats => ARRAY|REGEX (default [qw/html json phps yaml/])

    Specify what output formats are allowed. When client requests an unallowed format, 400 error is returned.

  • 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.