| 1 | package Plack::ResponseHelper::JSON; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use JSON; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Plack::Response; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | sub helper { |
|
Subroutine
helper: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 9 | 1 | ▶ | return sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 10 | 1 | my $r = shift; | |
| 11 | 1 | my $body = encode_json $r; | |
| 12 | 1 | my $response = Plack::Response->new(200); | |
| 13 | 1 | $response->content_type('application/json; charset=utf-8'); | |
| 14 | 1 | $response->body($body); | |
| 15 | 1 | return $response; | |
| 16 | 1 | }; | |
| 17 | } | ||
| 18 | |||
| 19 | 1 | 1; | |
| 20 | |||
| 21 | __END__ | ||