| 1 | 2 | ▶ | use v5.40; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 2 | ▶ | use experimental 'class'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | class Minima::View::JSON :isa(Minima::View); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | field $app :param; | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | method prepare_response ($response) | ||||||||
|
Subroutine
prepare_response: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 11 | { | ||||||||||
| 12 | 1 | $response->content_type('application/json'); | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 3 | ▶ | method render ($data = {}) | ||||||||
|
Subroutine
render: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 16 | 3 | { | |||||||||
| 17 | 3 | ▶ | $app->development | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | ? JSON->new->utf8->pretty->encode($data) | ||||||||||
| 19 | : encode_json $data | ||||||||||
| 20 | ; | ||||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | __END__ | ||||||||||