| 1 | package Parse::Win32Registry::Key; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 13 | ▶ | use base qw(Parse::Win32Registry::Entry); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 13 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 302 | ▶ | sub get_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 302 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # the root key of a windows 95 registry has no defined name | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # but this should be set to '' when created | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 302 | return $self->{_name}; | |||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 337 | ▶ | sub get_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_path: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 337 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 337 | return $self->{_key_path}; | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 117 | ▶ | sub _look_up_subkey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_look_up_subkey: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 117 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 117 | my $subkey_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 117 | ▶ | croak 'Missing subkey name' if !defined $subkey_name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 117 | foreach my $subkey ($self->get_list_of_subkeys) { | |||||||||||||||||||||||||||||||||||||||||
| 31 | 295 | ▶ | if (uc $subkey_name eq uc $subkey->{_name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 117 | return $subkey; | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 89 | ▶ | sub get_subkey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_subkey: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 89 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 89 | my $subkey_path = shift; | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | # check for definedness in case key name is '' or '0' | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 89 | ▶ | croak "Usage: get_subkey('key name')" if !defined $subkey_path; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 88 | my $key = $self; | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | # Current path component separator is '\' to match that used in Windows. | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # split returns nothing if it is given an empty string, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # and without a limit of -1 drops trailing empty fields. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # The following returns a list with a single zero-length string ("") | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # for an empty string, as split(/\\/, $subkey_path, -1) returns (), | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # an empty list. | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 88 | ▶ | my @path_components = index($subkey_path, "\\") == -1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | ? ($subkey_path) | ||||||||||||||||||||||||||||||||||||||||||
| 55 | : split(/\\/, $subkey_path, -1); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 88 | my %offsets_seen = (); | |||||||||||||||||||||||||||||||||||||||||
| 58 | 88 | $offsets_seen{$key->get_offset} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 88 | foreach my $subkey_name (@path_components) { | |||||||||||||||||||||||||||||||||||||||||
| 61 | 117 | ▶ | if (my $subkey = $key->_look_up_subkey($subkey_name)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 117 | ▶ | if (exists $offsets_seen{$subkey->get_offset}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return; # found loop | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 117 | $key = $subkey; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 117 | $offsets_seen{$key->get_offset} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | else { # subkey name not found, abort look up | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 88 | return $key; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 185 | ▶ | sub get_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_value: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 185 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 185 | my $value_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # check for definedness in case value name is '' or '0' | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 185 | ▶ | croak "Usage: get_value('value name')" if !defined $value_name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 184 | foreach my $value ($self->get_list_of_values) { | |||||||||||||||||||||||||||||||||||||||||
| 83 | 4594 | ▶ | if (uc $value_name eq uc $value->{_name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 184 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub print_summary { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_summary: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | print $self->as_string, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 37 | ▶ | sub as_regedit_export { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_regedit_export: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 37 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 37 | return "[" . $self->{_key_path} . "]\n"; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 59 | ▶ | sub regenerate_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
regenerate_path: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 59 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | # ascend to the root | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 59 | my $key = $self; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 59 | my @key_names = ($key->get_name); | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 59 | my %offsets_seen = (); | |||||||||||||||||||||||||||||||||||||||||
| 110 | 59 | ▶ | while (!$key->is_root) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 104 | $offsets_seen{$key->get_offset}++; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 104 | $key = $key->get_parent; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 104 | ▶ | if (!defined $key) { # found an undefined parent key | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | unshift @key_names, '(Invalid Parent Key)'; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 104 | ▶ | if (exists $offsets_seen{$key->get_offset}) { # found loop | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | unshift @key_names, '(Invalid Parent Key)'; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 104 | unshift @key_names, $key->get_name; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 59 | my $key_path = join('\\', @key_names); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 59 | $self->{_key_path} = $key_path; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 59 | return $key_path; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 92 | ▶ | sub get_value_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_value_data: called CC=3 SCAR=11.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 92 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 92 | my $value_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 92 | ▶ | croak "Usage: get_value_data('value name')" if !defined $value_name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 92 | ▶ | if (my $value = $self->get_value($value_name)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 92 | return $value->get_data; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub get_mru_list_of_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_mru_list_of_values: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my @values = (); | |||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if (my $mrulist = $self->get_value('MRUList')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | foreach my $ch (split(//, $mrulist->get_data)) { | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if (my $value = $self->get_value($ch)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | push @values, $value; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | elsif (my $mrulistex = $self->get_value('MRUListEx')) { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | foreach my $item (unpack('V*', $mrulistex->get_data)) { | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | last if $item == 0xffffffff; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if (my $value = $self->get_value($item)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | push @values, $value; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return @values; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 227 | ▶ | sub get_list_of_subkeys { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_list_of_subkeys: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 227 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 227 | my $subkey_iter = $self->get_subkey_iterator; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 227 | my @subkeys; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 227 | ▶ | while (my $subkey = $subkey_iter->()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 556 | push @subkeys, $subkey; | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 227 | return @subkeys; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 291 | ▶ | sub get_list_of_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_list_of_values: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 291 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 291 | my $value_iter = $self->get_value_iterator; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 291 | my @values; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 291 | ▶ | while (my $value = $value_iter->()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 9262 | push @values, $value; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 291 | return @values; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 6 | ▶ | sub get_subtree_iterator { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_subtree_iterator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 6 | my @start_keys = ($self); | |||||||||||||||||||||||||||||||||||||||||
| 190 | 12 | ▶ | push my (@subkey_iters), Parse::Win32Registry::Iterator->new(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 12 | return shift @start_keys; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 6 | }); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 6 | my $value_iter; | |||||||||||||||||||||||||||||||||||||||||
| 194 | my $key; # used to remember key while iterating values | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 66 | ▶ | return Parse::Win32Registry::Iterator->new(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 66 | ▶ | if (defined $value_iter && wantarray) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $value_iter and wantarray
MC/DC100%2/2
defined $value_iter and wantarray
defined $value_iter
wantarray
Truth table100%3/3
A and B
A= defined $value_iterB= wantarray
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 40 | my $value = $value_iter->(); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 40 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 26 | return ($key, $value); | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | # $value_iter finished, so fetch a new one | ||||||||||||||||||||||||||||||||||||||||||
| 203 | # from the (current) $subkey_iter[-1] | ||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 40 | ▶ | while (@subkey_iters > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 74 | $key = $subkey_iters[-1]->(); # depth-first | |||||||||||||||||||||||||||||||||||||||||
| 207 | 74 | ▶ | if (defined $key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 34 | push @subkey_iters, $key->get_subkey_iterator; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 34 | $value_iter = $key->get_value_iterator; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 34 | return $key; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 40 | pop @subkey_iters; # $subkey_iter finished, so remove it | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 6 | }); | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 14 | ▶ | sub walk { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
walk: called CC=9 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 14 | my $key_enter_func = shift; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 14 | my $value_func = shift; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 14 | my $key_leave_func = shift; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 14 | ▶ | if (!defined $key_enter_func && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $key_enter_func or defined $value_func or defined $key_leave_func
defined $key_enter_func or defined $value_func
MC/DC0%0/3
defined $key_enter_func or defined $value_func or defined $key_leave_func
defined $key_enter_func
defined $value_func
defined $key_leave_func
Truth table25%1/4
A or B or C
A= defined $key_enter_funcB= defined $value_funcC= defined $key_leave_func
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | !defined $value_func && | ||||||||||||||||||||||||||||||||||||||||||
| 226 | !defined $key_leave_func) { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $key_enter_func = sub { print "+ ", $_[0]->get_path, "\n"; }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $value_func = sub { print " '", $_[0]->get_name, "'\n"; }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $key_leave_func = sub { print "- ", $_[0]->get_path, "\n"; }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 14 | ▶ | $key_enter_func->($self) if ref $key_enter_func eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 14 | foreach my $value ($self->get_list_of_values) { | |||||||||||||||||||||||||||||||||||||||||
| 235 | 26 | ▶ | $value_func->($value) if ref $value_func eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 14 | foreach my $subkey ($self->get_list_of_subkeys) { | |||||||||||||||||||||||||||||||||||||||||
| 239 | 12 | $subkey->walk($key_enter_func, $value_func, $key_leave_func); | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 14 | ▶ | $key_leave_func->($self) if ref $key_leave_func eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 13 | 1; | |||||||||||||||||||||||||||||||||||||||||