blib/lib/Net/UPnP/HTTPResponse.pm

filter: Statementstmt 85.7% 30 / 35 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.8% 9 / 11 Podpod 0.0% 0 / 8 totaltotal 72.4% 42 / 58 CC 3 SCAR 4.9
CC
3
Cov
85%
getstatuscode
3.1
getstatus
2.0
getheader
2.0
CRAP 1.6
« blib/lib/Net/UPnP/Device.pm ↑ Summary blib/lib/Net/UPnP/QueryResponse.pm »
1 package Net::UPnP::HTTPResponse;
2  
3 #-----------------------------------------------------------------
4 # Net::UPnP::HTTPResponse
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 vars qw($_STATUS $_HEADER $_CONTENT);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 8 $_STATUS = 'status';
13 8 $_HEADER = 'header';
14 8 $_CONTENT = 'content';
15  
16 #------------------------------
17 # new
18 #------------------------------
19  
20 1068 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
21 1068 my($class) = shift;
22 1068 my($this) = {
23 $Net::UPnP::HTTPResponse::_STATUS => '',
24 $Net::UPnP::HTTPResponse::_HEADER => '',
25 $Net::UPnP::HTTPResponse::_CONTENT => '',
26 };
27 1068 bless $this, $class;
28 }
29  
30 #------------------------------
31 # status
32 #------------------------------
33  
34 1057 ▶sub setstatus() {
Subroutine setstatus: called CC=1 SCAR=0.0
Pod undocumented
35 1057 my($this) = shift;
36 1057 $this->{$Net::UPnP::HTTPResponse::_STATUS} = $_[0];
37 }
38  
39 0 ▶sub getstatus() {
Subroutine getstatus: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my($this) = shift;
41 0 $this->{$Net::UPnP::HTTPResponse::_STATUS};
42 }
43  
44 2094 ▶sub getstatuscode() {
Subroutine getstatuscode: called CC=3 SCAR=11.2
Pod undocumented
45 2094 my($this) = shift;
46 2094 my($status) = $this->{$Net::UPnP::HTTPResponse::_STATUS};
47 2094 ▶ if (length($status) <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $status <= 0) 11 2083 2094
48 11 return 0;
49 }
50 2083 ▶ if($status =~ m/^HTTP\/\d.\d\s+(\d+)\s+.*/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status =~ m[^HTTP/\d.\d\s+(\d+)\s+.*]i) 2083 0 2083
51 2083 return $1;
52 }
53 0 return 0;
54 }
55  
56 #------------------------------
57 # header
58 #------------------------------
59  
60 12 ▶sub setheader() {
Subroutine setheader: called CC=1 SCAR=0.0
Pod undocumented
61 12 my($this) = shift;
62 12 $this->{$Net::UPnP::HTTPResponse::_HEADER} = $_[0];
63 }
64  
65 0 ▶sub getheader() {
Subroutine getheader: not called CC=1 SCAR=6.9
Pod undocumented
66 0 my($this) = shift;
67 0 $this->{$Net::UPnP::HTTPResponse::_HEADER};
68 }
69  
70 #------------------------------
71 # content
72 #------------------------------
73  
74 1057 ▶sub setcontent() {
Subroutine setcontent: called CC=1 SCAR=0.0
Pod undocumented
75 1057 my($this) = shift;
76 1057 $this->{$Net::UPnP::HTTPResponse::_CONTENT} = $_[0];
77 }
78  
79 1053 ▶sub getcontent() {
Subroutine getcontent: called CC=1 SCAR=0.0
Pod undocumented
80 1053 my($this) = shift;
81 1053 $this->{$Net::UPnP::HTTPResponse::_CONTENT};
82 }
83  
84 8 1;
85  
86  
87 __END__
« blib/lib/Net/UPnP/Device.pm ↑ Summary blib/lib/Net/UPnP/QueryResponse.pm »