Client/Bayeux/Utilities.pm

filter: Statementstmt 60.0% 15 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 54.2% 19 / 35 CC 3 SCAR 17.4
CC
3
Cov
52%
decode_json_response
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« Server/Bayeux/Utilities.pm ↑ Summary Client/Bayeux/Transport.pm »
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
BranchTrueFalseTotal
if ($response->content_type eq "text/json-comment-filtered") 0 0 0
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
BranchTrueFalseTotal
if ($@) 0 0 0
25 0 die "Failed to JSON decode data (error $@). Content:\n" . $content;
26 }
27  
28 0 return $object;
29 }
30  
31 3 1;
« Server/Bayeux/Utilities.pm ↑ Summary Client/Bayeux/Transport.pm »