| 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
| |||||||||||
| 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
| |||||||||||
| 103 | 1 | $value = $1; | |||||||||
| 104 | } | ||||||||||
| 105 | |||||||||||
| 106 | 1 | return $value; | |||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | 8 | 1; | |||||||||
| 110 | |||||||||||
| 111 | __END__ | ||||||||||