| 1 | package Net::HTTP::Spore::Middleware::Format::JSON; | ||
| 2 | 3 | $Net::HTTP::Spore::Middleware::Format::JSON::VERSION = '0.09'; | |
| 3 | # ABSTRACT: middleware for JSON format | ||
| 4 | |||
| 5 | 3 | ▶ | use JSON; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | extends 'Net::HTTP::Spore::Middleware::Format'; | |
| 8 | |||
| 9 | has _json_parser => ( | ||
| 10 | is => 'rw', | ||
| 11 | isa => 'JSON', | ||
| 12 | lazy => 1, | ||
| 13 | 2 | ▶ | default => sub { JSON->new->utf8(1)->allow_nonref }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 14 | 3 | ); | |
| 15 | |||
| 16 | 1 | ▶ | sub encode { $_[0]->_json_parser->encode( $_[1] ); } |
|
Subroutine
encode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 17 | 3 | ▶ | sub decode { $_[0]->_json_parser->decode( $_[1] ); } |
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 18 | 3 | ▶ | sub accept_type { ( 'Accept' => 'application/json' ) } |
|
Subroutine
accept_type: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | 1 | ▶ | sub content_type { ( 'Content-Type' => 'application/json;' ) } |
|
Subroutine
content_type: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | |||
| 21 | 3 | 1; | |
| 22 | |||
| 23 | __END__ | ||