line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::Client::Bayeux::Utilities; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
116
|
|
4
|
3
|
|
|
3
|
|
22
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
84
|
|
5
|
3
|
|
|
3
|
|
19
|
use JSON::Any; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
34
|
|
6
|
3
|
|
|
3
|
|
17067
|
use base qw(Exporter); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
877
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw(decode_json_response); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $json_any = JSON::Any->new(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub decode_json_response { |
13
|
0
|
|
|
0
|
0
|
|
my ($response) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $content = $response->content; |
16
|
0
|
0
|
|
|
|
|
if ($response->content_type eq 'text/json-comment-filtered') { |
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
|
0
|
|
|
|
|
if ($@) { |
25
|
0
|
|
|
|
|
|
die "Failed to JSON decode data (error $@). Content:\n" . $content; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
return $object; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |