| 1 | package B::XPath; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 4 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use B; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub fetch_root | ||||||||||||||||||||||||||||
| 12 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
fetch_root: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | 2 | my ($class, $sub) = @_; | |||||||||||||||||||||||||||
| 14 | 2 | my $op = B::svref_2object( $sub )->ROOT(); | |||||||||||||||||||||||||||
| 15 | 2 | my $op_class = $class->find_op_class( $op ); | |||||||||||||||||||||||||||
| 16 | 2 | return $op_class->create( root => $op ); | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub fetch_main_root | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
fetch_main_root: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 0 | my ($class) = @_; | |||||||||||||||||||||||||||
| 22 | 0 | my $op = B::main_root(); | |||||||||||||||||||||||||||
| 23 | 0 | my $op_class = $class->find_op_class( $op ); | |||||||||||||||||||||||||||
| 24 | 0 | return $op_class->create( root => $op ); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub find_op_class | ||||||||||||||||||||||||||||
| 28 | 27 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
find_op_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 27 | my ($class, $op) = @_; | |||||||||||||||||||||||||||
| 30 | 27 | my $node_class = blessed( $op ); | |||||||||||||||||||||||||||
| 31 | 27 | $node_class =~ s/(::\w+)$/::XPath$1/; | |||||||||||||||||||||||||||
| 32 | 27 | return $node_class; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | package B::XPath::Node; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | use Class::XPath | ||||||||||||||||||||||||||||
| 38 | 4 | ▶ | get_name => 'name', | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | get_parent => 'parent', | ||||||||||||||||||||||||||||
| 40 | get_root => 'get_root', | ||||||||||||||||||||||||||||
| 41 | get_children => 'get_children', | ||||||||||||||||||||||||||||
| 42 | get_attr_names => 'get_attr_names', | ||||||||||||||||||||||||||||
| 43 | get_attr_value => 'get_attr_value', | ||||||||||||||||||||||||||||
| 44 | 4 | get_content => 'get_content'; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | sub create | ||||||||||||||||||||||||||||
| 47 | 26 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 48 | 26 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 49 | 26 | my $self = \%args; | |||||||||||||||||||||||||||
| 50 | 26 | ▶ | @args{qw( op root )} = ($args{root}, $self) unless $args{op}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 26 | bless $self, $class; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 26 | $self->create_children(); | |||||||||||||||||||||||||||
| 55 | 23 | return $self; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | sub get_root | ||||||||||||||||||||||||||||
| 59 | 26 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_root: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 60 | 26 | my $self = shift; | |||||||||||||||||||||||||||
| 61 | 26 | return $self->{root}; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | sub op | ||||||||||||||||||||||||||||
| 65 | 45 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
op: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 66 | 45 | my $self = shift; | |||||||||||||||||||||||||||
| 67 | 45 | return $self->{op}; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | sub parent | ||||||||||||||||||||||||||||
| 71 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
parent: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||
| 72 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 73 | 2 | ▶ | return unless exists $self->{parent}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 2 | return $self->{parent}; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | sub create_children | ||||||||||||||||||||||||||||
| 78 | 26 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create_children: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 79 | 26 | my $self = shift; | |||||||||||||||||||||||||||
| 80 | 26 | my $root = $self->get_root(); | |||||||||||||||||||||||||||
| 81 | 26 | my $kids = $self->{children} = []; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 26 | for my $kid ($self->kids()) | |||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||
| 85 | 25 | my $kid_class = B::XPath->find_op_class( $kid ); | |||||||||||||||||||||||||||
| 86 | 25 | push @$kids, $kid_class->create( | |||||||||||||||||||||||||||
| 87 | op => $kid, | ||||||||||||||||||||||||||||
| 88 | root => $root, | ||||||||||||||||||||||||||||
| 89 | parent => $self, | ||||||||||||||||||||||||||||
| 90 | ); | ||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub kids | ||||||||||||||||||||||||||||
| 95 | 15 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
kids: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||
| 96 | 15 | my $self = shift; | |||||||||||||||||||||||||||
| 97 | 15 | ▶ | return unless $self->name() eq 'null'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | sub get_children | ||||||||||||||||||||||||||||
| 101 | 6 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_children: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 102 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 103 | 6 | ▶ | return unless $self->{children}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | 6 | return @{ $self->{children} }; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | sub get_name | ||||||||||||||||||||||||||||
| 108 | 7 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 109 | 7 | my $self = shift; | |||||||||||||||||||||||||||
| 110 | 7 | return $self->name(); | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub DESTROY {} | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | sub AUTOLOAD | ||||||||||||||||||||||||||||
| 116 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 117 | 3 | our $AUTOLOAD; | |||||||||||||||||||||||||||
| 118 | 3 | my $self = $_[0]; | |||||||||||||||||||||||||||
| 119 | 3 | my ($method) = $AUTOLOAD =~ /::(\w+)$/; | |||||||||||||||||||||||||||
| 120 | 3 | my $op = $self->op(); | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 3 | ▶ | die "Unimplemented method $method for $self\n" unless $op->can( $method ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 3 | ▶ | my $sub = sub { shift->op()->$method() }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 124 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 125 | 3 | *{ Scalar::Util::blessed( $self ) . '::' . $method } = $sub; | |||||||||||||||||||||||||||
| 126 | 3 | goto &$sub; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | sub get_attr_value | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_value: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 131 | 0 | my ($self, $attr) = @_; | |||||||||||||||||||||||||||
| 132 | 0 | my $op = $self->op(); | |||||||||||||||||||||||||||
| 133 | 0 | ▶ | return unless $op->can( $attr ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 0 | return $op->$attr(); | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | sub get_nextstate | ||||||||||||||||||||||||||||
| 138 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_nextstate: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||
| 139 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 140 | 2 | ▶ | return $self->{nextstate} if $self->{nextstate}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | 2 | $self->{nextstate} = $self->find_nextstate(); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub find_nextstate | ||||||||||||||||||||||||||||
| 145 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
find_nextstate: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||
| 146 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 147 | 2 | my $parent = $self->parent(); | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 2 | my $nextstate; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 2 | for my $sibling ( $parent->get_children() ) | |||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||
| 153 | 6 | ▶ | last if $sibling eq $self; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 4 | ▶ | next unless $sibling->name() eq 'nextstate'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 3 | $nextstate = $sibling; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 2 | ▶ | return $nextstate if defined $nextstate; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | return $parent->find_nextstate(); | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | sub get_line | ||||||||||||||||||||||||||||
| 163 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_line: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 164 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 165 | 0 | my $nextstate = $self->get_nextstate(); | |||||||||||||||||||||||||||
| 166 | 0 | return $nextstate->line(); | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | sub get_file | ||||||||||||||||||||||||||||
| 170 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_file: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 171 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 172 | 0 | my $nextstate = $self->get_nextstate(); | |||||||||||||||||||||||||||
| 173 | 0 | return $nextstate->file(); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | sub name | ||||||||||||||||||||||||||||
| 177 | 24 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 178 | 24 | my $self = shift; | |||||||||||||||||||||||||||
| 179 | 24 | my $name = $self->op()->name(); | |||||||||||||||||||||||||||
| 180 | 24 | ▶ | return $name unless $name eq 'null'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 3 | return substr( B::ppname( $self->targ() ), 3 ); | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | package B::XPath::NULL; | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 4 | ▶ | use base 'B::XPath::Node'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | package B::XPath::OP; | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 4 | ▶ | use base 'B::XPath::Node'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | sub get_attr_names | ||||||||||||||||||||||||||||
| 193 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 194 | 0 | return qw( sibling ppaddr desc targ type opt static flags private spare ); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | sub get_content | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 199 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 200 | 0 | return $self->name(); | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | package B::XPath::UNOP; | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 4 | ▶ | use base 'B::XPath::Node'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | sub kids | ||||||||||||||||||||||||||||
| 208 | 7 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
kids: called CC=5 SCAR=16.5
| |||||||||||||||||||||||||||||
| 209 | 7 | my $self = shift; | |||||||||||||||||||||||||||
| 210 | 7 | my $op = $self->op(); | |||||||||||||||||||||||||||
| 211 | 7 | my $first = $op->first(); | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 7 | my @kids = $first; | |||||||||||||||||||||||||||
| 214 | 7 | my $sibling = $first; | |||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 7 | ▶ | while ($sibling = $sibling->sibling()) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | { | ||||||||||||||||||||||||||||
| 218 | 11 | ▶ | if ($sibling->isa( 'B::NULL' ) and $sibling->can( 'kids' )) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sibling->isa("B::NULL") and $sibling->can("kids")
MC/DC0%0/2
$sibling->isa("B::NULL") and $sibling->can("kids")
$sibling->isa("B::NULL")
$sibling->can("kids")
Truth table66%2/3
A and B
A= $sibling->isa("B::NULL")B= $sibling->can("kids")
| |||||||||||||||||||||||||||||
| 219 | { | ||||||||||||||||||||||||||||
| 220 | 0 | push @kids, $sibling->kids(); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | 11 | ▶ | last if $sibling->isa( 'B::NULL' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 4 | push @kids, $sibling; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 7 | return @kids; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | package B::XPath::BINOP; | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 4 | ▶ | use base 'B::XPath::UNOP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | sub kids | ||||||||||||||||||||||||||||
| 234 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
kids: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 235 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 236 | 2 | return $self->SUPER::kids(); | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | package B::XPath::LOGOP; | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 4 | ▶ | use base 'B::XPath::UNOP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | sub kids | ||||||||||||||||||||||||||||
| 244 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
kids: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 246 | 0 | return $self->SUPER::kids(), $self->other(); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | package B::XPath::LISTOP; | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 4 | ▶ | use base 'B::XPath::BINOP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | sub kids | ||||||||||||||||||||||||||||
| 254 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
kids: called CC=6 SCAR=18.4
| |||||||||||||||||||||||||||||
| 255 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 256 | 4 | my $op = $self->op(); | |||||||||||||||||||||||||||
| 257 | 4 | my $first = $op->first(); | |||||||||||||||||||||||||||
| 258 | 4 | my $last = $op->last(); | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 4 | my @kids = $first; | |||||||||||||||||||||||||||
| 261 | 4 | my $sibling = $first; | |||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 4 | ▶ | while ($sibling = $sibling->sibling()) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||
| 265 | 16 | ▶ | if ($sibling->isa( 'B::NULL' ) and $sibling->can( 'kids' )) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sibling->isa("B::NULL") and $sibling->can("kids")
MC/DC0%0/2
$sibling->isa("B::NULL") and $sibling->can("kids")
$sibling->isa("B::NULL")
$sibling->can("kids")
Truth table66%2/3
A and B
A= $sibling->isa("B::NULL")B= $sibling->can("kids")
| |||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||
| 267 | 0 | push @kids, $sibling->kids(); | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | 16 | ▶ | last if $sibling->isa( 'B::NULL' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 12 | push @kids, $sibling; | |||||||||||||||||||||||||||
| 271 | 12 | ▶ | last if $sibling == $last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 4 | return @kids; | |||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | package B::XPath::LOOP; | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 4 | ▶ | use base 'B::XPath::LISTOP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | sub kids | ||||||||||||||||||||||||||||
| 282 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
kids: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 283 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 284 | 0 | my $op = $self->op(); | |||||||||||||||||||||||||||
| 285 | 0 | return $op->nextop(), $op->lastop(), $op->redoop(); | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | package B::XPath::COP; | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 4 | ▶ | use base 'B::XPath::OP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | sub get_attr_names | ||||||||||||||||||||||||||||
| 293 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 294 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 295 | 0 | return $self->SUPER::get_attr_names(), | |||||||||||||||||||||||||||
| 296 | qw( label stash stashpv file cop_seq arybase line warnings io ); | ||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | package B::XPath::SVOP; | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | # this package is different; SVOPs contain GVs/SVs | ||||||||||||||||||||||||||||
| 302 | # however, they don't look like it in the optree | ||||||||||||||||||||||||||||
| 303 | # op() here thus delegates all calls to the contained GV | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 4 | ▶ | use base 'B::XPath::OP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | # the parent name() uses op(), which is wrong here | ||||||||||||||||||||||||||||
| 308 | sub name | ||||||||||||||||||||||||||||
| 309 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 310 | 2 | return $_[0]->{op}->name(); | |||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | # hey, these look like GV attributes! | ||||||||||||||||||||||||||||
| 314 | sub get_attr_names | ||||||||||||||||||||||||||||
| 315 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 316 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 317 | 0 | my @names = $self->SUPER::get_attr_names(); | |||||||||||||||||||||||||||
| 318 | 0 | return @names, | |||||||||||||||||||||||||||
| 319 | qw( NAME SAFENAME STASH SV IO FORM AV HV EGV CV CVGEN LINE FILE FILEGV | ||||||||||||||||||||||||||||
| 320 | GvREFCNT FLAGS ); | ||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | # you don't want me, you want my GV | ||||||||||||||||||||||||||||
| 324 | sub op | ||||||||||||||||||||||||||||
| 325 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
op: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 326 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 327 | 0 | return $self->{op}->gv(); | |||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | package B::XPath::PADOP; | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 4 | ▶ | use base 'B::XPath::OP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | sub get_attr_names | ||||||||||||||||||||||||||||
| 335 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 336 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 337 | 0 | return $self->SUPER::get_attr_names(), qw( padix ); | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | package B::XPath::PVOP; | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 4 | ▶ | use base 'B::XPath::OP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | sub get_attr_names | ||||||||||||||||||||||||||||
| 345 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 346 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 347 | 0 | return $self->SUPER::get_attr_names(), qw( pv ); | |||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | package B::XPath::SV; | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 4 | ▶ | use base 'B::XPath::Node'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | sub get_name | ||||||||||||||||||||||||||||
| 355 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 356 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 357 | 0 | return $self->name(); | |||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 0 | ▶ | sub get_root {} | ||||||||||||||||||||||||||
|
Subroutine
get_root: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 361 | 0 | ▶ | sub get_content {} | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 362 | 0 | ▶ | sub get_attr_names {} | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | package B::XPath::IV; | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 4 | ▶ | use base 'B::XPath::SV'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | sub get_content | ||||||||||||||||||||||||||||
| 369 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 371 | 0 | my $op = shift; | |||||||||||||||||||||||||||
| 372 | 0 | return $op->int_value(); | |||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | sub get_attr_names | ||||||||||||||||||||||||||||
| 376 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 377 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 378 | 0 | my @names = $self->SUPER::get_attr_names(); | |||||||||||||||||||||||||||
| 379 | 0 | return @names, qw( needs64bits packiv ); | |||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | package B::XPath::NV; | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | 4 | ▶ | use base 'B::XPath::IV'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | sub get_content | ||||||||||||||||||||||||||||
| 387 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 388 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 389 | 0 | return $self->op()->NV(); | |||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | package B::XPath::RV; | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 4 | ▶ | use base 'B::XPath::SV'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | sub get_content | ||||||||||||||||||||||||||||
| 397 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 398 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 399 | 0 | return $self->op()->RV(); | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | package B::XPath::PV; | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 4 | ▶ | use base 'B::XPath::SV'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | 0 | ▶ | sub name { 'pv' } | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | sub get_content | ||||||||||||||||||||||||||||
| 409 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 410 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 411 | 0 | return $self->op()->PV(); | |||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | package B::XPath::PVNV; | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | 4 | ▶ | use base qw( B::XPath::PV B::XPath::NV ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | package B::XPath::PVMG; | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | 4 | ▶ | use base 'B::XPath::PVNV'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | package B::XPath::GV; | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | 4 | ▶ | use base 'B::XPath::PVMG'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 0 | ▶ | sub name { 'gv' } | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | sub get_content | ||||||||||||||||||||||||||||
| 429 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 430 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 431 | 0 | return $self->op()->SAFENAME(); | |||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | sub get_attr_names | ||||||||||||||||||||||||||||
| 435 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_attr_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 436 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 437 | 0 | my @names = $self->SUPER::get_attr_names(); | |||||||||||||||||||||||||||
| 438 | 0 | return @names, | |||||||||||||||||||||||||||
| 439 | qw( NAME SAFENAME STASH SV IO FORM AV HV EGV CV CVGEN LINE FILE FILEGV | ||||||||||||||||||||||||||||
| 440 | GvREFCNT FLAGS ); | ||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 4 | 1; | |||||||||||||||||||||||||||
| 444 | __END__ | ||||||||||||||||||||||||||||