| 1 | package POE::Component::Client::Bayeux::Utilities; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use JSON::Any; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use base qw(Exporter); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 3 | our @EXPORT_OK = qw(decode_json_response); | |||||||||
| 9 | |||||||||||
| 10 | 3 | my $json_any = JSON::Any->new(); | |||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | sub decode_json_response { | ||||||||
|
Subroutine
decode_json_response: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 13 | 0 | my ($response) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 0 | my $content = $response->content; | |||||||||
| 16 | 0 | ▶ | if ($response->content_type eq 'text/json-comment-filtered') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | $content =~ s{^\s* /\* \s* (.+?) \s* \*/ \s*$}{$1}x; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | my $object; | |||||||||
| 21 | 0 | eval { | |||||||||
| 22 | 0 | $object = $json_any->decode($content); | |||||||||
| 23 | }; | ||||||||||
| 24 | 0 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | die "Failed to JSON decode data (error $@). Content:\n" . $content; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | return $object; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 3 | 1; | |||||||||