Client/Response/Property.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 45 CC 7 SCAR 27.1
CC
7
Cov
0%
value
30.0
numchildren
6.0
childs
6.0
CRAP 15.0
1 package DBGp::Client::Response::Property;
2  
3 use strict;
4 use warnings;
5 use parent qw(DBGp::Client::Response::Simple);
6  
7 __PACKAGE__->make_attrib_accessors(qw(
8 name fullname constant type children address pagesize page classname key facet size
9 ));
10  
11 sub numchildren { $_[0]->{attrib}{children} ? $_[0]->{attrib}{numchildren} : 0 }
12  
13 sub value {
14 my $value = DBGp::Client::Parser::_node($_[0], 'value');
15  
16 if (!$value) {
17 # Xdebug compat
18 my $text = DBGp::Client::Parser::_text($_[0]);
19  
20 return undef unless $text =~ /\S/;
21  
22 my $encoding = $_[0]->{attrib}{encoding};
23 return DBGp::Client::Parser::_decode($text, $encoding);
24 }
25  
26 if (my $encoding = $value->{attrib}{encoding}) {
27 my $text = DBGp::Client::Parser::_text($value);
28  
29 return length($text) ? DBGp::Client::Parser::_decode($text, $encoding) : undef;
30 }
31 }
32  
33 sub childs {
34 return [] unless $_[0]->children;
35  
36 return [
37 map bless($_, 'DBGp::Client::Response::Property'),
38 DBGp::Client::Parser::_nodes($_[0], 'property'),
39 ];
40 }
41  
42 1;