| 1 | package POE::Filter::XML::RPC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use POE::Filter::XML::RPC::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use POE::Filter::XML::RPC::Response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use POE::Filter::XML::RPC::Fault; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use POE::Filter::XML::Node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use base('POE::Filter'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | use constant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | BUFFER => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | sub new() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my $self = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | $self->[+BUFFER] = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | return bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | sub get_one_start() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_one_start: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my ($self, $raw) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if(@{$self->[+BUFFER]}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | push(@{$self->[+BUFFER]}, @$raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } elsif(ref($raw) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $self->[+BUFFER] = $raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $self->[+BUFFER] = [$raw]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | sub get_one() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_one: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $self = shift(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $node = shift(@{$self->[+BUFFER]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if(defined($node)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if($node->nodeName() eq 'methodCall') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if($node->exists('child::methodName')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if(!$node->exists('child::methodName/child::text()')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 102, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 'Malformed XML-RPC: No methodName data defined' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 103, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 'Malformed XML-RPC: No methodName child tag present' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # params are optional, but let's be consistent for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # Request code's sake. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if(!$node->exists('child::params')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $node->appendChild('params'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $params =()= $node->findnodes('child::params/child::param'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $vals =()= $node->findnodes('child::params/child::param/child::value'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if($vals < $params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 110, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 'Malformed XML-RPC: No value tag within param' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | return [bless($node, 'POE::Filter::XML::RPC::Request')]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } elsif ($node->nodeName() eq 'methodResponse') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if(!$node->exists('child::params') and !$node->exists('child::fault')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$node->exists('child::params') || $node->exists('child::fault')
MC/DC0%0/2
$node->exists('child::params') || $node->exists('child::fault')
$node->exists('child::params')
$node->exists('child::fault')
Truth table0%0/3
A || B
A= $node->exists('child::params')B= $node->exists('child::fault')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 104, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 'Malformed XML-RPC: Response does not contain ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 'parameters or a fault object' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } elsif($node->exists('child::params')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $params =()= $node->findnodes('child::params/child::param'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if(!$params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 105, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 'Malformed XML-RPC: Return parameters does ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 'not contain any param children' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $node_count =()= $node->findnodes('child::params/child::*'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if($node_count > $params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 108, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 'Malformed XML-RPC: Params object ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 'contains children other than param' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $value_count =()= $node->findnodes('child::params/child::param/child::value'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if($value_count < $params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 109, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 'Malformed XML-RPC: Param child does '. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 'not contain a value object' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } elsif($node->exists('child::fault')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if(!$node->exists('child::fault/child::value')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 106, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 'Malformed XML-RPC: Fault value is not a ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 'valid struct object' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if(!$node->exists('child::fault/child::value/child::struct')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 106, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 'Malformed XML-RPC: Fault value is not a ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 'valid struct object' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $code = $node->findvalue('child::fault/child::value/child::struct/child::member[child::name/child::text() = "faultCode"]/child::value/child::*/child::text()'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $string = $node->findvalue('child::fault/child::value/child::struct/child::member[child::name/child::text() = "faultString"]/child::value/child::*/child::text()'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if(!defined($code) or !defined($string) or !length($code) or !length($string)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
defined $code and defined $string and length $code and length $string
defined $code and defined $string and length $code
defined $code and defined $string
MC/DC0%0/4
defined $code and defined $string and length $code and length $string
defined $code
defined $string
length $code
length $string
Truth table0%0/5
A and B and C and D
A= defined $codeB= defined $stringC= length $codeD= length $string
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 107, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 'Malformed XML-RPC: Fault value does not ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 'contain either a fault code or fault string' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | return [bless($node, 'POE::Filter::XML::RPC::Response')]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | POE::Filter::XML::RPC::Response->new | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | POE::Filter::XML::RPC::Fault->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 101, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 'Malformed XML-RPC: Top level node is not valid' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | sub put() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my ($self, $nodes) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $ret = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | foreach my $node (@$nodes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | push(@$ret, bless($node, 'POE::Filter::XML::Node')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | POE::Filter::XML::RPC - A POE Filter for marshalling XML-RPC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | use POE::Filter::XML::RPC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | use POE::Filter::XML::RPC::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | use POE::Filter::XML::RPC::Response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | use POE::Filter::XML::RPC::Fault; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | use POE::Filter::XML::RPC::Value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | my $filter = POE::Filter::XML::RPC->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # Build/send a request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | my $request = POE::Filter::XML::RPC::Request->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 'server_method', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | POE::Filter::XML::RPC::Value->new({'NamedArgument' => 42}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | $filter->put($request); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # Build/send a response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | my $reponse = POE::Filter::XML::RPC::Response->new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | POE::Filter::XML::RPC::Value->new([qw/somevalue1 somevalue2/]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | $filter->put($reponse); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | POE::Filter::XML::RPC builds upon the work of POE::Filter::XML to parse XML-RPC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | datagrams and deliver useful objects for the end developer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | This filter is expected to be used in a chain of filters where it will receive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | POE::Filter::XML::Nodes on input and output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | =head1 PUBLIC METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | There are no public methods outside of the implemented POE::Filter API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | =head1 NOTES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | Response, Request, Fault, and Value are based on POE::Filter::XML::Node. See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | their individual PODs for more information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | This filter only implements part of the XMLRPC spec[1], the HTTP portion is not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | accounted for within this filter and in fact, only concerns itself with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | POE::Filter::XML::Nodes received or sent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | [1]: http://www.xmlrpc.com/spec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | Copyright 2009 Nicholas Perez. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | Licensed and distributed under the GPL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||