Group
Extension

Matches 2

Plack-ResponseHelper ( K/KO/KOMAROV/Plack-ResponseHelper-0.05.tar.gz, KOMAROV, 2012; MetaCPAN )
Plack-ResponseHelper/lib/Plack/ResponseHelper/JSON.pm ( view source; MetaCPAN )
ge Plack::ResponseHelper::JSON;
use strict;
use warnings;

use JSON;
use Plack::Response;

sub helper {
    return sub {
        my $r = shift;
        my $body = encode_json $r;
        my $response 
->content_type('application/json; charset=utf-8');
        $response->body($body);
        return $response;
    };
}

1;

__END__

=head1 NAME

Plack::ResponseHelper::JSON

=head1 SEE ALSO

Plack::Re
Plack-ResponseHelper ( K/KO/KOMAROV/Plack-ResponseHelper-0.05.tar.gz, KOMAROV, 2012; MetaCPAN )
Plack-ResponseHelper/lib/Plack/ResponseHelper.pm ( view source; MetaCPAN )
 it as a micro-framework:

in app.psgi

    use Plack::Request;
    use Plack::ResponseHelper json => 'JSON',
                              text => 'Text';

    my $app = sub {
        my $env = shift
$form);
    };

somewhere in your controllers

    sub my_controller {
        ...
        return json => {status => 'ok', data => [1, 2, 3]};
    }

    # or
    sub dummy_controller {
        return
s Plack's specifics.

Bundled with
L<Plack::ResponseHelper::Attachment>,
L<Plack::ResponseHelper::JSON>,
L<Plack::ResponseHelper::Redirect>,
L<Plack::ResponseHelper::Text>.

=head1 METHODS

=head2 use

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.