blib/lib/Net/UPnP/QueryResponse.pm

filter: Statementstmt 78.7% 37 / 47 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 76.9% 10 / 13 Podpod 25.0% 2 / 8 totaltotal 70.8% 51 / 72 CC 3 SCAR 4.8
CC
3
Cov
76%
getvalue
3.1
getstatus
2.0
getheader
2.0
CRAP 1.6
« blib/lib/Net/UPnP/HTTPResponse.pm ↑ Summary blib/lib/Net/UPnP/AV/Item.pm »
1 package Net::UPnP::QueryResponse;
2  
3 #-----------------------------------------------------------------
4 # Net::UPnP::QueryResponse
5 #-----------------------------------------------------------------
6  
7 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 ▶use Net::UPnP::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 8 ▶use Net::UPnP::HTTPResponse;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 8 ▶use vars qw($_HTTP_RESPONSE);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 8 $_HTTP_RESPONSE = 'httpres';
16  
17 #------------------------------
18 # new
19 #------------------------------
20  
21 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
22 4 my($class) = shift;
23 4 my($this) = {
24 $Net::UPnP::QueryResponse::_HTTP_RESPONSE => undef,
25 };
26 4 bless $this, $class;
27 }
28  
29 #------------------------------
30 # header
31 #------------------------------
32  
33 4 ▶sub sethttpresponse() {
Subroutine sethttpresponse: called CC=1 SCAR=0.0
Pod undocumented
34 4 my($this) = shift;
35 4 $this->{$Net::UPnP::QueryResponse::_HTTP_RESPONSE} = $_[0];
36 }
37  
38 5 ▶sub gethttpresponse() {
Subroutine gethttpresponse: called CC=1 SCAR=0.0
Pod undocumented
39 5 my($this) = shift;
40 5 $this->{$Net::UPnP::QueryResponse::_HTTP_RESPONSE};
41 }
42
43 #------------------------------
44 # status
45 #------------------------------
46  
47 0 ▶sub getstatus() {
Subroutine getstatus: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my($this) = shift;
49 0 my($http_res) = $this->gethttpresponse();
50 0 $http_res->getstatus();
51 }
52  
53 4 ▶sub getstatuscode() {
Subroutine getstatuscode: called CC=1 SCAR=0.0
Pod documented
54 4 my($this) = shift;
55 4 my($http_res) = $this->gethttpresponse();
56 4 $http_res->getstatuscode();
57 }
58  
59 #------------------------------
60 # header
61 #------------------------------
62  
63 0 ▶sub getheader() {
Subroutine getheader: not called CC=1 SCAR=6.9
Pod undocumented
64 0 my($this) = shift;
65 0 my($http_res) = $this->gethttpresponse();
66 0 $http_res->getheader();
67 }
68  
69 #------------------------------
70 # content
71 #------------------------------
72  
73 0 ▶sub getcontent() {
Subroutine getcontent: not called CC=1 SCAR=6.9
Pod undocumented
74 0 my($this) = shift;
75 0 my($http_res) = $this->gethttpresponse();
76 0 $http_res->getcontent();
77 }
78  
79 #------------------------------
80 # content
81 #------------------------------
82  
83 1 ▶sub getvalue() {
Subroutine getvalue: called CC=3 SCAR=11.2
Pod documented
84 1 my($this) = shift;
85 my(
86 1 $http_res,
87 $res_statcode,
88 $res_content,
89 $value,
90 );
91
92 1 $http_res = $this->gethttpresponse();
93
94 1 $res_statcode = $http_res->getstatuscode();
95 1 ▶ if ($res_statcode != 200) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res_statcode != 200) 0 1 1
96 0 return "";
97 }
98  
99 1 $value = "";
100
101 1 $res_content = $http_res->getcontent();
102 1 ▶ if ($res_content =~ m{<return>(.*?)</return>}si) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res_content =~ m[<return>(.*?)</return>]is) 1 0 1
103 1 $value = $1;
104 }
105  
106 1 return $value;
107 }
108  
109 8 1;
110  
111 __END__
« blib/lib/Net/UPnP/HTTPResponse.pm ↑ Summary blib/lib/Net/UPnP/AV/Item.pm »