| 1 | # You may distribute under the terms of either the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # (C) Paul Evans, 2013-2026 -- leonerd@leonerd.org.uk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | package Devel::MAT::SV 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use v5.20; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use feature qw( postderef signatures ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | no warnings qw( experimental::postderef experimental::signatures ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | use Scalar::Util qw( weaken ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | ▶ | use Syntax::Keyword::Match; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # Load XS code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 10 | require Devel::MAT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | ▶ | use constant immortal => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | ▶ | use List::Util qw( first ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | ▶ | use Struct::Dumb 0.07 qw( readonly_struct ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 10 | readonly_struct Reference => [qw( name strength sv )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | C<Devel::MAT::SV> - represent a single SV from a heap dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | Objects in this class represent individual SV variables found in the arena | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | during a heap dump. Actual types of SV are represented by subclasses, which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | are documented below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 10 | my $CONSTANTS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 10 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 10 | $CONSTANTS = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | STRENGTH_STRONG => (1 << 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | STRENGTH_WEAK => (1 << 1), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | STRENGTH_INDIRECT => (1 << 2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | STRENGTH_INFERRED => (1 << 3), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 10 | $CONSTANTS->{STRENGTH_DIRECT} = $CONSTANTS->{STRENGTH_STRONG}|$CONSTANTS->{STRENGTH_WEAK}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | $CONSTANTS->{STRENGTH_ALL} = $CONSTANTS->{STRENGTH_STRONG}|$CONSTANTS->{STRENGTH_WEAK}|$CONSTANTS->{STRENGTH_INDIRECT}|$CONSTANTS->{STRENGTH_INFERRED}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | my %types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 190 | ▶ | sub register_type ( $pkg, $type_id ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_type: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 190 | $types{$type_id} = $pkg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # generate the ->type constant method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 190 | ( my $typename = $pkg ) =~ s/^Devel::MAT::SV:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 190 | ▶ | *{"${pkg}::type"} = sub ($) { $typename } unless defined *{"${pkg}::type"}{CODE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 983828 | ▶ | sub new ( $, $type, $df, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 983828 | ▶ | my $class = $types{$type} or croak "Cannot load unknown SV type $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 983828 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 983828 | $self->_set_core_fields( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | $type, $df, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ( unpack "$df->{ptr_fmt} $df->{u32_fmt} $df->{uint_fmt}", $header ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $ptrs->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 983828 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | =head1 COMMON METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | =for highlighter language=perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | =head2 type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | $type = $sv->type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | Returns the major type of the SV. This is the class name minus the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | C<Devel::MAT::SV::> prefix. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =head2 basetype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | $type = $sv->basetype; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | Returns the inner perl API type of the SV. This is one of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =for highlighter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | SV AV HV CV GV LV PVIO PVFM REGEXP INVLIST OBJ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | =for highlighter language=perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | =head2 desc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | $desc = $sv->desc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Returns a string describing the type of the SV and giving a short detail of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | its contents. The exact details depends on the SV type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | =head2 desc_addr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | $desc = $sv->desc_addr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | Returns a string describing the SV as with C<desc> and giving its address in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | hex. A useful way to uniquely identify the SV when printing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub desc_addr ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc_addr: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return sprintf "%s at %#x", $self->desc, $self->addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | =head2 addr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | $addr = $sv->addr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | Returns the address of the SV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # XS accessor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | =head2 refcnt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | $count = $sv->refcnt;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | Returns the C<SvREFCNT> reference count of the SV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | =head2 refcount_adjusted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | $count = $sv->refcount_adjusted; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | Returns the reference count of the SV, adjusted to take account of the fact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | that the C<SvREFCNT> value of the backrefs list of a hash or weakly-referenced | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | object is artificially high. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # XS accessor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub refcount_adjusted ( $self ) { $self->refcnt } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refcount_adjusted: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | =head2 blessed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | $stash = $sv->blessed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | If the SV represents a blessed object, returns the stash SV. Otherwise returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 265310 | ▶ | sub blessed ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
blessed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 265310 | return $self->df->sv_at( $self->blessed_at ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | =head2 symname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | $name = $sv->symname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Called on an SV which is a member of the symbol table, this method returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | perl representation of the full symbol name, including sigil. Otherwise, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | returns C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | A leading C<main::> prefix is removed for symbols in packages other than | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | C<main>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 5 | ▶ | my $mksymname = sub ( $sigil, $glob ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 5 | my $stashname = $glob->stashname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 5 | ▶ | $stashname =~ s/^main::// if $stashname =~ m/^main::.+::/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 5 | return $sigil . $stashname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | sub symname ( $ ) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | =head2 size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | $size = $sv->size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | Returns the (approximate) size in bytes of the SV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # XS accessor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | =head2 magic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | @magics = $sv->magic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | Returns a list of magic applied to the SV; each giving the type and target SVs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | as struct fields. The exact structures for v1 and v2 magic differ. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | For (original) Magic v1: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | $magic->ver == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $type = $magic->type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | $sv = $magic->obj; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | $sv = $magic->ptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | $ptr = $magic->vtbl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | For Magic v2: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | $magic->ver == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | $u16 = $magic->priv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | $len = $magic->ptrlen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | $iv = $magic->keyiv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | $ptr = $magic->funcs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | $sv = $magic->auxsv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | $ptr = $magic->ptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | $sv = $magic->keysv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | $struct = $magic->userstruct; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub magic ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
magic: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | return unless my $magic = $self->{magic}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | return @$magic; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | =head2 magic_svs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | @svs = $sv->magic_svs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | A more efficient way to retrieve just the SVs associated with the applied | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | magic. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 35756 | ▶ | sub magic_svs ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
magic_svs: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 35756 | ▶ | return unless my $magic = $self->{magic}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 602 | my $mg = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 602 | ▶ | if( $mg->ver == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 602 | grep { defined } $mg->obj, $mg->ptr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | elsif( $mg->ver == 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | grep { defined } $mg->auxsv, $mg->keysv, $mg->userstruct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } @$magic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =head2 backrefs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | $av_or_rv = $sv->backrefs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | Returns backrefs SV, which may be an AV containing the back references, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | if there is only one, the REF SV itself referring to this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | ▶ | sub backrefs ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
backrefs: called CC=5 SCAR=19.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | ▶ | return undef unless my $magic = $self->{magic}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | foreach my $mg ( @$magic ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # backrefs list uses "<" magic v1 type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | if( $mg->ver == 1 and $mg->type eq "<" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$mg->ver == 1 and $mg->type eq "<"
MC/DC0%0/2
$mg->ver == 1 and $mg->type eq "<"
$mg->ver == 1
$mg->type eq "<"
Truth table33%1/3
A and B
A= $mg->ver == 1B= $mg->type eq "<"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | return $mg->obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | =head2 rootname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | $rootname = $sv->rootname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | If the SV is a well-known root, this method returns its name. Otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | returns C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 4 | ▶ | sub rootname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rootname: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 4 | return $self->{rootname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # internal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 10 | package Devel::MAT::SV::_Magic { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 61511 | ▶ | sub new ( $class, @args ) { bless [ @args[0..5], (undef)x2 ], $class } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 21709 | ▶ | sub ver { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ver: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 37691 | ▶ | sub df ( $self ) { $self->[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
df: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 21107 | ▶ | sub type ( $self ) { $self->[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 18921 | ▶ | sub flags ( $self ) { $self->[2] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flags: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # [3] == obj_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # [4] == ptr_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub vtbl ( $self ) { $self->[5] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vtbl: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # obj and ptr have to be resolved lazily, in case the SVs they point at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # weren't yet loaded at construction time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 21709 | ▶ | sub obj ( $self ) { $self->[6] //= $self->df->sv_at( $self->[3] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
obj: called CC=2 SCAR=6.9
Condition100%3/3
$self->[6] //= $self->df->sv_at($self->[3])
MC/DC100%2/2
$self->[6] //= $self->df->sv_at($self->[3])
$self->[6]
$self->df->sv_at($self->[3])
Truth table100%3/3
A //= B
A= $self->[6]B= $self->df->sv_at($self->[3])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 21708 | ▶ | sub ptr ( $self ) { $self->[7] //= $self->df->sv_at( $self->[4] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ptr: called CC=2 SCAR=7.2
Condition66%2/3
$self->[7] //= $self->df->sv_at($self->[4])
MC/DC50%1/2
$self->[7] //= $self->df->sv_at($self->[4])
$self->[7]
$self->df->sv_at($self->[4])
Truth table66%2/3
A //= B
A= $self->[7]B= $self->df->sv_at($self->[4])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 61511 | ▶ | sub more_magic ( $self, $type, $flags, $obj_at, $ptr_at, $vtbl_ptr ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
more_magic: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 61511 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | push $self->{magic}->@*, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 61511 | Devel::MAT::SV::_Magic->new( $df, $type, $flags, $obj_at, $ptr_at, $vtbl_ptr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 10 | package Devel::MAT::SV::_Magicv2 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | sub new ( $class, @args ) { bless [ @args[0..9], (undef)x2 ], $class } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | sub ver { 2 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ver: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | sub df ( $self ) { $self->[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
df: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub flags ( $self ) { $self->[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flags: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub priv ( $self ) { $self->[2] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
priv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub ptrlen ( $self ) { $self->[3] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ptrlen: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | sub keyiv ( $self ) { $self->[4] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keyiv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | sub funcs ( $self ) { $self->[5] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
funcs: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # [6] == auxsv_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | sub ptr ( $self ) { $self->[7] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ptr: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # [8] == keysv_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # [9] == userstruct_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # auxsv, keysv and userstruct have to be resolved lazily, in case the SVs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # they point at weren't yet loaded at construction time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | sub auxsv ( $self ) { $self->[10] //= $self->df->sv_at( $self->[6] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auxsv: not called CC=2 SCAR=17.9
Condition0%0/3
$self->[10] //= $self->df->sv_at($self->[6])
MC/DC0%0/2
$self->[10] //= $self->df->sv_at($self->[6])
$self->[10]
$self->df->sv_at($self->[6])
Truth table0%0/3
A //= B
A= $self->[10]B= $self->df->sv_at($self->[6])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | sub keysv ( $self ) { $self->[11] //= $self->df->sv_at( $self->[8] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keysv: not called CC=2 SCAR=17.9
Condition0%0/3
$self->[11] //= $self->df->sv_at($self->[8])
MC/DC0%0/2
$self->[11] //= $self->df->sv_at($self->[8])
$self->[11]
$self->df->sv_at($self->[8])
Truth table0%0/3
A //= B
A= $self->[11]B= $self->df->sv_at($self->[8])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub userstruct ( $self ) { $self->[12] //= $self->df->sv_at( $self->[9] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
userstruct: not called CC=2 SCAR=17.9
Condition0%0/3
$self->[12] //= $self->df->sv_at($self->[9])
MC/DC0%0/2
$self->[12] //= $self->df->sv_at($self->[9])
$self->[12]
$self->df->sv_at($self->[9])
Truth table0%0/3
A //= B
A= $self->[12]B= $self->df->sv_at($self->[9])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | sub more_magicv2 ( $self, $flags, $priv, $ptrlen, $keyiv, $mg_ptr, $funcs_ptr, $auxsv_at, $ptr, $keysv_at ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
more_magicv2: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | push $self->{magic}->@*, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | Devel::MAT::SV::_Magicv2->new( $df, $flags, $priv, $ptrlen, $keyiv, $mg_ptr, $funcs_ptr, $auxsv_at, $ptr, $keysv_at ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | sub _more_annotations ( $self, $val_at, $name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_more_annotations: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | push $self->{annotations}->@*, [ $val_at, $name ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # DEBUG_LEAKING_SCALARS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | sub _debugdata ( $self, $serial, $line, $file ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debugdata: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $self->{debugdata} = [ $serial, $line, $file ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | sub debug_serial ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_serial: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | return $self->{debugdata} && $self->{debugdata}[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'debugdata'} && $self->{'debugdata'}[0]
MC/DC0%0/2
$self->{'debugdata'} && $self->{'debugdata'}[0]
$self->{'debugdata'}
$self->{'debugdata'}[0]
Truth table0%0/3
A && B
A= $self->{'debugdata'}B= $self->{'debugdata'}[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub debug_line ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_line: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | return $self->{debugdata} && $self->{debugdata}[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'debugdata'} && $self->{'debugdata'}[1]
MC/DC0%0/2
$self->{'debugdata'} && $self->{'debugdata'}[1]
$self->{'debugdata'}
$self->{'debugdata'}[1]
Truth table0%0/3
A && B
A= $self->{'debugdata'}B= $self->{'debugdata'}[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub debug_file ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_file: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | return $self->{debugdata} && $self->{debugdata}[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'debugdata'} && $self->{'debugdata'}[2]
MC/DC0%0/2
$self->{'debugdata'} && $self->{'debugdata'}[2]
$self->{'debugdata'}
$self->{'debugdata'}[2]
Truth table0%0/3
A && B
A= $self->{'debugdata'}B= $self->{'debugdata'}[2]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | =head2 outrefs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | @refs = $sv->outrefs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | Returns a list of Reference objects for each of the SVs that this one refers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | to, either directly by strong or weak reference, indirectly via RV, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | inferred by C<Devel::MAT> itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | Each object is a structure of three fields: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | =item name => STRING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | A human-readable string for identification purposes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | =item strength => "strong"|"weak"|"indirect"|"inferred" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | Identifies what kind of reference it is. C<strong> references contribute to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | the C<refcount> of the referrant, others do not. C<strong> and C<weak> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | references are SV addresses found directly within the referring SV structure; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | C<indirect> and C<inferred> references are extra return values added here for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | convenience by examining the surrounding structure. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | =item sv => SV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | The referrant SV itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 265317 | ▶ | sub _outrefs_matching ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs_matching: called CC=33 SCAR=52.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # In scalar context we're just counting so we might as well count just SVs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 265317 | ▶ | $no_desc ||= !wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$no_desc ||= !wantarray
MC/DC50%1/2
$no_desc ||= !wantarray
$no_desc
!wantarray
Truth table66%2/3
A ||= not(B)
A= $no_descB= !wantarray
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 265317 | my @outrefs = $self->_outrefs( $match, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 265317 | ▶ | if( $match & STRENGTH_WEAK and my $blessed = $self->blessed ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$match & 2 and my $blessed = $self->blessed
MC/DC100%2/2
$match & 2 and my $blessed = $self->blessed
$match & 2
my $blessed = $self->blessed
Truth table100%3/3
A and B
A= $match & 2B= my $blessed = $self->blessed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1308 | ▶ | push @outrefs, $no_desc ? ( weak => $blessed ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | Reference( "the bless package", weak => $blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 265317 | ▶ | foreach my $mg ( ( $self->{magic} || [] )->@* ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'magic'} || []
MC/DC100%1/1
$self->{'magic'} || []
$self->{'magic'}
Truth table100%2/2
A
A= $self->{'magic'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 21106 | my $ver = $mg->ver; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 21106 | ▶ | if( $ver == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 21106 | my $type = $mg->type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 21106 | ▶ | if( my $obj = $mg->obj ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 18921 | my $is_strong = ( $mg->flags & 0x01 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 18921 | ▶ | if( $match & ( $is_strong ? STRENGTH_STRONG : STRENGTH_WEAK ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 18921 | ▶ | my $strength = $is_strong ? "strong" : "weak"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 18921 | ▶ | push @outrefs, $no_desc ? ( $strength => $obj ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | Reference( "'$type' magic object", $strength => $obj ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 21106 | ▶ | if( $match & STRENGTH_STRONG and my $ptr = $mg->ptr ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$match & 1 and my $ptr = $mg->ptr
MC/DC50%1/2
$match & 1 and my $ptr = $mg->ptr
$match & 1
my $ptr = $mg->ptr
Truth table66%2/3
A and B
A= $match & 1B= my $ptr = $mg->ptr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 88 | ▶ | push @outrefs, $no_desc ? ( strong => $ptr ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | Reference( "'$type' magic pointer", strong => $ptr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | elsif( $ver == 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | if( my $auxsv = $mg->auxsv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $is_strong = !( $mg->flags & 0x01 ); # WEAK_AUXSV flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | if( $match & ( $is_strong ? STRENGTH_STRONG : STRENGTH_WEAK ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | my $strength = $is_strong ? "strong" : "weak"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | push @outrefs, $no_desc ? ( $strength => $auxsv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | Reference( "MagicV2 auxsv", $strength => $auxsv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | if( $match & STRENGTH_STRONG and my $keysv = $mg->keysv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$match & 1 and my $keysv = $mg->keysv
MC/DC0%0/2
$match & 1 and my $keysv = $mg->keysv
$match & 1
my $keysv = $mg->keysv
Truth table0%0/3
A and B
A= $match & 1B= my $keysv = $mg->keysv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $keysv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | Reference( "MagicV2 keysv", strong => $keysv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if( $match & STRENGTH_STRONG and my $userstruct = $mg->userstruct ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$match & 1 and my $userstruct = $mg->userstruct
MC/DC0%0/2
$match & 1 and my $userstruct = $mg->userstruct
$match & 1
my $userstruct = $mg->userstruct
Truth table0%0/3
A and B
A= $match & 1B= my $userstruct = $mg->userstruct
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $userstruct ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | Reference( "MagicV2 userstruct", strong => $userstruct ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 265317 | ▶ | foreach my $ann ( ( $self->{annotations} || [] )->@* ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'annotations'} || []
MC/DC0%0/1
$self->{'annotations'} || []
$self->{'annotations'}
Truth table50%1/2
A
A= $self->{'annotations'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my ( $val_at, $name ) = @$ann; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | my $val = $self->df->sv_at( $val_at ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $val ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | Reference( $name, strong => $val ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 265317 | ▶ | return @outrefs / 2 if !wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 265317 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 265301 | ▶ | sub outrefs ( $self, $no_desc = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outrefs: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 265301 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 265301 | return $self->_outrefs_matching( STRENGTH_ALL, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | =head2 outrefs_strong | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | @refs = $sv->outrefs_strong; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | Returns the subset of C<outrefs> that are direct strong references. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | =head2 outrefs_weak | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | @refs = $sv->outrefs_weak; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | Returns the subset of C<outrefs> that are direct weak references. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | =head2 outrefs_direct | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | @refs = $sv->outrefs_direct; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | Returns the subset of C<outrefs> that are direct strong or weak references. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | =head2 outrefs_indirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | @refs = $sv->outrefs_indirect; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | Returns the subset of C<outrefs> that are indirect references via RVs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | =head2 outrefs_inferred | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | @refs = $sv->outrefs_inferred; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | Returns the subset of C<outrefs> that are not directly stored in the SV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | structure, but instead inferred by C<Devel::MAT> itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 14 | ▶ | sub outrefs_strong ( $self, $no_desc = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outrefs_strong: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 14 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 14 | return $self->_outrefs_matching( STRENGTH_STRONG, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | sub outrefs_weak ( $self, $no_desc = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outrefs_weak: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | return $self->_outrefs_matching( STRENGTH_WEAK, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | ▶ | sub outrefs_direct ( $self, $no_desc = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outrefs_direct: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | return $self->_outrefs_matching( STRENGTH_DIRECT, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 1 | ▶ | sub outrefs_indirect ( $self, $no_desc = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outrefs_indirect: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 1 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 1 | return $self->_outrefs_matching( STRENGTH_INDIRECT, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | sub outrefs_inferred ( $self, $no_desc = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outrefs_inferred: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | return $self->_outrefs_matching( STRENGTH_INFERRED, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | =head2 outref_named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | $ref = $sv->outref_named( $name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | I<Since version 0.49.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | Looks for a reference whose name is exactly that given, and returns it if so. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | Throws an exception if the SV has no such outref of that name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | =head2 maybe_outref_named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | $ref = $sv->maybe_outref_named( $name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | I<Since version 0.49.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | As L</outref_named> but returns C<undef> if there is no such reference. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 2 | ▶ | sub maybe_outref_named ( $self, $name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maybe_outref_named: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 2 | ▶ | return first { $_->name eq $name } $self->outrefs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | ▶ | sub outref_named ( $self, $name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outref_named: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1 | ▶ | return $self->maybe_outref_named( $name ) // croak "No outref named $name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->maybe_outref_named($name) // croak("No outref named $name")
MC/DC0%0/1
$self->maybe_outref_named($name) // croak("No outref named $name")
$self->maybe_outref_named($name)
Truth table50%1/2
A
A= $self->maybe_outref_named($name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | =head2 is_mortal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | $mortal = $sv->is_mortal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | Returns true if this SV is referenced by the temps stack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 3 | ▶ | sub _set_is_mortal ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_is_mortal: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 3 | $self->{is_mortal} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 3856 | ▶ | sub is_mortal ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_mortal: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 3856 | return $self->{is_mortal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | =head1 IMMORTAL SVs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | Three special SV objects exist outside of the heap, to represent C<undef> and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | boolean true and false. They are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | =item * Devel::MAT::SV::UNDEF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | =item * Devel::MAT::SV::YES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | =item * Devel::MAT::SV::NO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | package Devel::MAT::SV::Immortal 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 10 | ▶ | use constant immortal => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 10 | ▶ | use constant basetype => "SV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 24 | ▶ | sub new ( $class, $df, $addr ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 24 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 24 | $self->_set_core_fields( 0, $df, $addr, 0, 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 24 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 3 | ▶ | sub _outrefs ( @ ) { () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | package Devel::MAT::SV::UNDEF 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 10 | ▶ | use base qw( Devel::MAT::SV::Immortal ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | sub desc ( $ ) { "UNDEF" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 1756 | ▶ | sub type ( $ ) { "UNDEF" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | package Devel::MAT::SV::YES 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 10 | ▶ | use base qw( Devel::MAT::SV::Immortal ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | sub desc ( $ ) { "YES" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 1147 | ▶ | sub type ( $ ) { "SCALAR" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # Pretend to be 1 / "1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | sub uv ( $ ) { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | sub iv ( $ ) { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | sub nv ( $ ) { 1.0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | sub pv ( $ ) { "1" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | sub rv ( $ ) { undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | sub is_weak ( $ ) { '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_weak: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | package Devel::MAT::SV::NO 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 10 | ▶ | use base qw( Devel::MAT::SV::Immortal ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | sub desc ( $ ) { "NO" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | sub type ( $ ) { "SCALAR" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | # Pretend to be 0 / "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | sub uv ( $ ) { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | sub iv ( $ ) { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | sub nv ( $ ) { 0.0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | sub pv ( $ ) { "0" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | sub rv ( $ ) { undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | sub is_weak ( $ ) { '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_weak: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | package Devel::MAT::SV::Unknown 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 10 | __PACKAGE__->register_type( 0xff ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | sub desc ( $ ) { "UNKNOWN" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | sub _outrefs ( @ ) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | package Devel::MAT::SV::GLOB 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 10 | __PACKAGE__->register_type( 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 10 | ▶ | use constant basetype => "GV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | =head1 Devel::MAT::SV::GLOB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | Represents a glob; an SV of type C<SVt_PVGV>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 83491 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 83491 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 83491 | my ( $line, $name_hek ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | unpack "$df->{uint_fmt} $df->{ptr_fmt}", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | $self->_set_glob_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 83491 | ▶ | @{$ptrs}[0..7], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$name_hek // 0
MC/DC0%0/1
$name_hek // 0
$name_hek
Truth table50%1/2
A
A= $name_hek
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | $name_hek // 0, $line, $strs->[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | $strs->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 83491 | ▶ | sub _fixup ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fixup: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 83491 | ▶ | $_ and $_->_set_glob_at( $self->addr ) for $self->scalar, $self->array, $self->hash, $self->code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | =head2 file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | =head2 line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | =head2 location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | $file = $gv->file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | $line = $gv->line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | $location = $gv->location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | Returns the filename, line number, or combined location (C<FILE line LINE>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | that the GV first appears at. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | =head2 name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | $name = $gv->name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | Returns the value of the C<GvNAME> field, for named globs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | # XS accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | sub location ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | my $line = $self->line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | defined $file ? "$file line $line" : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | =head2 stash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | $stash = $gv->stash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | Returns the stash to which the GV belongs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 29 | ▶ | sub stash ( $self ) { $self->df->sv_at( $self->stash_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | =head2 scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | =head2 array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | =head2 hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | =head2 code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | =head2 egv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | =head2 io | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | =head2 form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | $sv = $gv->scalar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | $av = $gv->array; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | $hv = $gv->hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | $cv = $gv->code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | $gv = $gv->egv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | $io = $gv->io; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | $form = $gv->form; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | Return the SV in the various glob slots. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 140954 | ▶ | sub scalar ( $self ) { $self->df->sv_at( $self->scalar_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scalar: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 140949 | ▶ | sub array ( $self ) { $self->df->sv_at( $self->array_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
array: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 141386 | ▶ | sub hash ( $self ) { $self->df->sv_at( $self->hash_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 140955 | ▶ | sub code ( $self ) { $self->df->sv_at( $self->code_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
code: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 47481 | ▶ | sub egv ( $self ) { $self->df->sv_at( $self->egv_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
egv: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 57452 | ▶ | sub io ( $self ) { $self->df->sv_at( $self->io_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
io: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 57451 | ▶ | sub form ( $self ) { $self->df->sv_at( $self->form_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
form: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 29 | ▶ | sub stashname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stashname: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 29 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | $name =~ s(^([\x00-\x1f])){"^" . chr(64 + ord $1)}e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 29 | return $self->stash->stashname . "::" . $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 20871 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 20871 | my $sigils = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 20871 | ▶ | $sigils .= '$' if $self->scalar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 20871 | ▶ | $sigils .= '@' if $self->array; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 20871 | ▶ | $sigils .= '%' if $self->hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 20871 | ▶ | $sigils .= '&' if $self->code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 20871 | ▶ | $sigils .= '*' if $self->egv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 20871 | ▶ | $sigils .= 'I' if $self->io; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 20871 | ▶ | $sigils .= 'F' if $self->form; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 20871 | return "GLOB($sigils)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 26610 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 26610 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 26610 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 26610 | foreach my $slot (qw( scalar array hash code io form )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 159660 | ▶ | my $sv = $self->$slot or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 25216 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | Devel::MAT::SV::Reference( "the $slot", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 26610 | ▶ | if( my $egv = $self->egv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | # the egv is weakref if if it points back to itself | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 26598 | my $egv_is_self = $egv == $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 26598 | ▶ | if( $match & ( $egv_is_self ? STRENGTH_WEAK : STRENGTH_STRONG ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 26598 | ▶ | my $strength = $egv_is_self ? "weak" : "strong"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 26598 | ▶ | push @outrefs, $no_desc ? ( $strength => $egv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | Devel::MAT::SV::Reference( "the egv", $strength => $egv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 26610 | foreach my $saved ( $self->{saved}->@* ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 4 | my $sv = $self->df->sv_at( $saved->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 4 | ▶ | push @outrefs, $no_desc ? ( inferred => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | Devel::MAT::SV::Reference( "saved value of " . Devel::MAT::Cmd->format_note( $saved->[0] ) . " slot", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | "inferred", $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 26610 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 5 | ▶ | sub _more_saved ( $self, $slot, $addr ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_more_saved: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 5 | push $self->{saved}->@*, [ $slot => $addr ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | package Devel::MAT::SV::SCALAR 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 10 | __PACKAGE__->register_type( 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 10 | ▶ | use constant basetype => "SV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | =head1 Devel::MAT::SV::SCALAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | Represents a non-referential scalar value; an SV of any of the types up to and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | including C<SVt_PVMV> (that is, C<IV>, C<NV>, C<PV>, C<PVIV>, C<PVNV> or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | C<PVMG>). This includes all numbers, integers and floats, strings, and dualvars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | containing multiple parts. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 359219 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 359219 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 359219 | my ( $flags, $uv, $nvbytes, $pvlen ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | unpack "C $df->{uint_fmt} A$df->{nv_len} $df->{uint_fmt}", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 359219 | my $nv = unpack "$df->{nv_fmt}", $nvbytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # $strs->[0] will be swiped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 359219 | $self->_set_scalar_fields( $flags, $uv, $nv, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | $strs->[0], $pvlen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | $ptrs->[0], # OURSTASH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | # $strs->[0] is now undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 359219 | $flags &= ~0x1f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 359219 | ▶ | $flags and die sprintf "Unrecognised SCALAR flags %02x\n", $flags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | =head2 uv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | $uv = $sv->uv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | Returns the integer numeric portion as an unsigned value, if valid, or C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | =head2 iv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | $iv = $sv->iv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | Returns the integer numeric portion as a signed value, if valid, or C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | =head2 nv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | $nv = $sv->nv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | Returns the floating numeric portion, if valid, or C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | =head2 pv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | $pv = $sv->pv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | Returns the string portion, if valid, or C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | =head2 pvlen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | $pvlen = $sv->pvlen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | Returns the length of the string portion, if valid, or C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | # XS accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | =head2 qq_pv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | $str = $sv->qq_pv( $maxlen ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | Returns the PV string, if defined, suitably quoted. If C<$maxlen> is defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | and the PV is longer than this, it is truncated and C<...> is appended after | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | the containing quote marks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 5 | ▶ | sub qq_pv ( $self, $maxlen = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
qq_pv: called CC=10 SCAR=23.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 5 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 5 | ▶ | defined( my $pv = $self->pv ) or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 5 | ▶ | $pv = substr( $pv, 0, $maxlen ) if defined $maxlen and $maxlen < length $pv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $maxlen and $maxlen < length $pv
MC/DC50%1/2
defined $maxlen and $maxlen < length $pv
defined $maxlen
$maxlen < length $pv
Truth table66%2/3
A and B
A= defined $maxlenB= $maxlen < length $pv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 5 | my $truncated = $self->pvlen > length $pv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 5 | ▶ | if( $pv =~ m/^[\x20-\x7e]*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 3 | $pv =~ s/(['\\])/\\$1/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 3 | $pv = qq('$pv'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 2 | $pv =~ s{(\") | (\r) | (\n) | ([\x00-\x1f\x80-\xff])} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 2 | ▶ | {$1?'\\"' : $2?"\\r" : $3?"\\n" : sprintf "\\x%02x", ord $4}egx; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 2 | $pv = qq("$pv"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 5 | ▶ | $pv .= "..." if $truncated; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 5 | return $pv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | =head2 ourstash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | $stash = $sv->ourstash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | Returns the stash of the SCALAR, if it is an 'C<our>' variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | After perl 5.20 this is no longer used, and will return C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 166548 | ▶ | sub ourstash ( $self ) { return $self->df->sv_at( $self->ourstash_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ourstash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 2 | ▶ | sub symname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
symname: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 2 | ▶ | return unless my $glob_at = $self->glob_at; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 1 | return $mksymname->( '$', $self->df->sv_at( $glob_at ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 923945 | ▶ | sub type ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 923945 | ▶ | return "SCALAR" if defined $self->uv or defined $self->iv or defined $self->nv or defined $self->pv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
defined $self->uv or defined $self->iv or defined $self->nv or defined $self->pv
defined $self->uv or defined $self->iv or defined $self->nv
defined $self->uv or defined $self->iv
MC/DC100%4/4
defined $self->uv or defined $self->iv or defined $self->nv or defined $self->pv
defined $self->uv
defined $self->iv
defined $self->nv
defined $self->pv
Truth table100%5/5
A or B or C or D
A= defined $self->uvB= defined $self->ivC= defined $self->nvD= defined $self->pv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 384043 | return "UNDEF"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 166379 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 166379 | my @flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 166379 | ▶ | push @flags, "UV" if defined $self->uv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 166379 | ▶ | push @flags, "IV" if defined $self->iv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 166379 | ▶ | push @flags, "NV" if defined $self->nv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 166379 | ▶ | push @flags, "PV" if defined $self->pv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 166379 | local $" = ","; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 166379 | ▶ | return "UNDEF()" unless @flags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 89646 | return "SCALAR(@flags)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 118466 | ▶ | sub _set_shared_hek_at ( $self, $hek_at ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_shared_hek_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 118466 | $self->{shared_hek_at} = $hek_at; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | ▶ | sub shared_hek ( $self ) { return $self->{shared_hek_at}; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shared_hek: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 166548 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=4 SCAR=18.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 166548 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 166548 | ▶ | if( $match & STRENGTH_STRONG and my $ourstash = $self->ourstash ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$match & 1 and my $ourstash = $self->ourstash
MC/DC0%0/2
$match & 1 and my $ourstash = $self->ourstash
$match & 1
my $ourstash = $self->ourstash
Truth table33%1/3
A and B
A= $match & 1B= my $ourstash = $self->ourstash
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $ourstash ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | Devel::MAT::SV::Reference( "the our stash", strong => $ourstash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 166548 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | package Devel::MAT::SV::REF 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 10 | __PACKAGE__->register_type( 3 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 10 | ▶ | use constant basetype => "SV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | =head1 Devel::MAT::SV::REF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | Represents a referential scalar; any SCALAR-type SV with the C<SvROK> flag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 37576 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 37576 | ( my $flags ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | unpack "C", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | $self->_set_ref_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 37576 | @{$ptrs}[0,1], # RV, OURSTASH | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | $flags & 0x01, # RV_IS_WEAK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 37576 | $flags &= ~0x01; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 37576 | ▶ | $flags and die sprintf "Unrecognised REF flags %02x\n", $flags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | =head2 rv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | $svrv = $sv->rv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | Returns the SV referred to by the reference. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 22672 | ▶ | sub rv ( $self ) { $self->df->sv_at( $self->rv_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rv: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | =head2 is_weak | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | $weak = $sv->is_weak; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | Returns true if the SV is a weakened RV reference. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | # XS accessor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | =head2 ourstash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | $stash = $sv->ourstash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | Returns the stash of the SCALAR, if it is an 'C<our>' variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 9420 | ▶ | sub ourstash ( $self ) { $self->df->sv_at( $self->ourstash_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ourstash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 9391 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 9391 | ▶ | return sprintf "REF(%s)", $self->is_weak ? "W" : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 10 | *symname = \&Devel::MAT::SV::SCALAR::symname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 9420 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=9 SCAR=25.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 9420 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 9420 | my $is_weak = $self->is_weak; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 9420 | ▶ | if( $match & ( $is_weak ? STRENGTH_WEAK : STRENGTH_STRONG ) and my $rv = $self->rv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$match & ($is_weak ? 2 : 1) and my $rv = $self->rv
MC/DC0%0/2
$match & ($is_weak ? 2 : 1) and my $rv = $self->rv
$match & ($is_weak ? 2 : 1)
my $rv = $self->rv
Truth table33%1/3
A and B
A= $match & ($is_weak ? 2 : 1)B= my $rv = $self->rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 9420 | ▶ | my $strength = $is_weak ? "weak" : "strong"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 9420 | ▶ | push @outrefs, $no_desc ? ( $strength => $rv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | Devel::MAT::SV::Reference( "the referrant", $strength => $rv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 9420 | ▶ | if( $match & STRENGTH_STRONG and my $ourstash = $self->ourstash ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$match & 1 and my $ourstash = $self->ourstash
MC/DC0%0/2
$match & 1 and my $ourstash = $self->ourstash
$match & 1
my $ourstash = $self->ourstash
Truth table33%1/3
A and B
A= $match & 1B= my $ourstash = $self->ourstash
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $ourstash ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | Devel::MAT::SV::Reference( "the our stash", strong => $ourstash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 9420 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | package Devel::MAT::SV::BOOL 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 10 | ▶ | use base qw( Devel::MAT::SV::SCALAR ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 264 | ▶ | sub type ( $ ) { return "BOOL" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 54 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 54 | ▶ | return "BOOL(YES)" if $self->uv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 24 | return "BOOL(NO)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | package Devel::MAT::SV::ARRAY 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 10 | __PACKAGE__->register_type( 4 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 10 | ▶ | use constant basetype => "AV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | =head1 Devel::MAT::SV::ARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | Represents an array; an SV of type C<SVt_PVAV>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | sub refcount_adjusted ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refcount_adjusted: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | # AVs that are backrefs lists have an SvREFCNT artificially high | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | return $self->refcnt - ( $self->is_backrefs ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 100936 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 100936 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 100936 | my ( $n, $flags ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | unpack "$df->{uint_fmt} C", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 100936 | ▶ | $self->_set_array_fields( $flags || 0, [ $n ? $df->_read_ptrs($n) : () ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$flags || 0
MC/DC100%1/1
$flags || 0
$flags
Truth table100%2/2
A
A= $flags
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 1 | ▶ | sub _more_saved ( $self, $index, $addr ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_more_saved: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 1 | push $self->{saved}->@*, [ $index => $addr ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | =head2 is_unreal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | $unreal = $av->is_unreal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | Returns true if the C<AvREAL()> flag is not set on the array - i.e. that its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | SV pointers do not contribute to the C<SvREFCNT> of the SVs it points at. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | =head2 is_backrefs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | $backrefs = $av->is_backrefs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | Returns true if the array contains the backrefs list of a hash or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | weakly-referenced object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | # XS accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 4 | ▶ | sub symname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
symname: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 4 | ▶ | return unless my $glob_at = $self->glob_at; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 1 | return $mksymname->( '@', $self->df->sv_at( $glob_at ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | =head2 elems | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | @svs = $av->elems; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | Returns all of the element SVs in a list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 32025 | ▶ | sub elems ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elems: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 32025 | my $n = $self->n_elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 32025 | ▶ | return $n unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 17700 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 17700 | return map { $df->sv_at( $self->elem_at( $_ ) ) } 0 .. $n-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | =head2 elem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | $sv = $av->elem( $index ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | Returns the SV at the given index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 5866947 | ▶ | sub elem ( $self, $index ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elem: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 5866947 | return $self->df->sv_at( $self->elem_at( $index ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 14695 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 14695 | my @flags = $self->n_elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 14695 | ▶ | push @flags, "!REAL" if $self->is_unreal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 14695 | $" = ","; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 14695 | return "ARRAY(@flags)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 18597 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=18 SCAR=29.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 18597 | my $n = $self->n_elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 18597 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 18597 | ▶ | if( $self->is_unreal ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 14788 | ▶ | if( $match & STRENGTH_WEAK ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 14788 | foreach my $idx ( 0 .. $n-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | 5784325 | ▶ | my $sv = $self->elem( $idx ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 5784325 | ▶ | push @outrefs, $no_desc ? ( weak => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | Devel::MAT::SV::Reference( "element " . Devel::MAT::Cmd->format_value( $idx, index => 1 ), weak => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 3809 | foreach my $idx ( 0 .. $n-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 39332 | ▶ | my $sv = $self->elem( $idx ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 39049 | ▶ | my $name = $no_desc ? undef : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | "element " . Devel::MAT::Cmd->format_value( $idx, index => 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 39049 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 39048 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | Devel::MAT::SV::Reference( $name, strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 39049 | ▶ | if( $match & STRENGTH_INDIRECT and $sv->type eq "REF" and !$sv->{magic} and my $rv = $sv->rv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"}
$match & 4 and $sv->type eq "REF"
MC/DC50%2/4
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4
$sv->type eq "REF"
not $sv->{"magic"}
my $rv = $sv->rv
Truth table60%3/5
A and B and not(C) and D
A= $match & 4B= $sv->type eq "REF"C= not $sv->{"magic"}D= my $rv = $sv->rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 1622 | ▶ | push @outrefs, $no_desc ? ( indirect => $rv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | Devel::MAT::SV::Reference( $name . " via RV", indirect => $rv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 18597 | foreach my $saved ( $self->{saved}->@* ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 1 | my $sv = $self->df->sv_at( $saved->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 1 | ▶ | push @outrefs, $no_desc ? ( inferred => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | Devel::MAT::SV::Reference( "saved value of element " . Devel::MAT::Cmd->format_value( $saved->[0], index => 1 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | inferred => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 18597 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | package Devel::MAT::SV::PADLIST 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | # Synthetic type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 10 | ▶ | use base qw( Devel::MAT::SV::ARRAY ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 10 | ▶ | use constant type => "PADLIST"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | =head1 Devel::MAT::SV::PADLIST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | A subclass of ARRAY, this is used to represent the PADLIST of a CODE SV. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | ▶ | sub padcv ( $self ) { $self->df->sv_at( $self->padcv_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padcv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 0 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | return "PADLIST(" . $self->n_elems . ")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | # Totally different outrefs format than ARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | my $n = $self->n_elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | ▶ | if( my $padnames = $df->sv_at( $self->elem_at( 0 ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $padnames ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | Devel::MAT::SV::Reference( "the padnames", strong => $padnames ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | foreach my $idx ( 1 .. $n-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | ▶ | my $pad = $df->sv_at( $self->elem_at( $idx ) ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $pad ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | Devel::MAT::SV::Reference( "pad at depth $idx", strong => $pad ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | package Devel::MAT::SV::PADNAMES 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | # Synthetic type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 10 | ▶ | use base qw( Devel::MAT::SV::ARRAY ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 10 | ▶ | use constant type => "PADNAMES"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | =head1 Devel::MAT::SV::PADNAMES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | A subclass of ARRAY, this is used to represent the PADNAMES of a CODE SV. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | ▶ | sub padcv ( $self ) { $self->df->sv_at( $self->padcv_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padcv: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | =head2 padname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | $padname = $padnames->padname( $padix ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | Returns the name of the lexical at the given index, or C<undef> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | ▶ | sub padname ( $self, $padix ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padname: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | ▶ | my $namepv = $self->elem( $padix ) or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | ▶ | $namepv->type eq "SCALAR" or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | return $namepv->pv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | =head2 padix_from_padname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | $padix = $padnames->padix_from_padname( $padname ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | Returns the index of the lexical with the given name, or C<undef> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | ▶ | sub padix_from_padname ( $self, $padname ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padix_from_padname: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 0 | foreach my $padix ( 1 .. scalar( $self->elems ) - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | my $namepv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | ▶ | return $padix if $namepv = $self->elem( $padix ) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$namepv = $self->elem($padix) and $namepv->type eq "SCALAR" and $namepv->pv eq $padname
$namepv = $self->elem($padix) and $namepv->type eq "SCALAR"
MC/DC0%0/3
$namepv = $self->elem($padix) and $namepv->type eq "SCALAR" and $namepv->pv eq $padname
$namepv = $self->elem($padix)
$namepv->type eq "SCALAR"
$namepv->pv eq $padname
Truth table0%0/4
A and B and C
A= $namepv = $self->elem($padix)B= $namepv->type eq "SCALAR"C= $namepv->pv eq $padname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | $namepv->type eq "SCALAR" and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | $namepv->pv eq $padname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | return "PADNAMES(" . scalar($self->elems) . ")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | # Totally different outrefs format than ARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 0 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 0 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | my $n = $self->n_elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | foreach my $idx ( 1 .. $n-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 0 | ▶ | my $padname = $df->sv_at( $self->elem_at( $idx ) ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $padname ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | Devel::MAT::SV::Reference( "padname " . Devel::MAT::Cmd->format_value( $idx, index => 1 ), strong => $padname ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | package Devel::MAT::SV::PAD 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | # Synthetic type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 10 | ▶ | use base qw( Devel::MAT::SV::ARRAY ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 10 | ▶ | use constant type => "PAD"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | =head1 Devel::MAT::SV::PAD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | A subclass of ARRAY, this is used to represent a PAD of a CODE SV. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 10533 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 10533 | return "PAD(" . scalar($self->elems) . ")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | =head2 padcv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | $cv = $pad->padcv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | Returns the C<CODE> SV for which this is a pad. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 10557 | ▶ | sub padcv ( $self ) { $self->df->sv_at( $self->padcv_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padcv: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | =head2 lexvars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | ( $name, $sv, $name, $sv, ... ) = $pad->lexvars; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | Returns a name/value list of the lexical variables in the pad. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | ▶ | sub lexvars ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lexvars: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | my $padcv = $self->padcv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | my @svs = $self->elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | my $padname = $padcv->padname( $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | ▶ | $padname ? ( $padname->name => $svs[$_] ) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | } 1 .. $#svs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | =head2 maybe_lexvar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | $sv = $pad->maybe_lexvar( $padname ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | I<Since version 0.49.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | Returns the SV associated with the given padname if one exists, or C<undef> if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | Used to be named C<lexvar>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 5 | ▶ | sub maybe_lexvar ( $self, $padname ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maybe_lexvar: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 5 | ▶ | my $padix = $self->padcv->padix_from_padname( $padname ) or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 5 | return $self->elem( $padix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 10 | *lexvar = \&maybe_lexvar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | # Totally different outrefs format than ARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 10550 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=16 SCAR=27.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 10550 | my $padcv = $self->padcv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 10550 | my @svs = $self->elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 10550 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 10550 | ▶ | if( $match & STRENGTH_STRONG and my $argsav = $svs[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$match & 1 and my $argsav = $svs[0]
MC/DC50%1/2
$match & 1 and my $argsav = $svs[0]
$match & 1
my $argsav = $svs[0]
Truth table66%2/3
A and B
A= $match & 1B= my $argsav = $svs[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 9736 | ▶ | push @outrefs, $no_desc ? ( strong => $argsav ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | Devel::MAT::SV::Reference( "the " . Devel::MAT::Cmd->format_note( '@_', 1 ) . " av", strong => $argsav ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 10550 | foreach my $idx ( 1 .. $#svs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 85305 | ▶ | my $sv = $svs[$idx] or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 82477 | my $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 82477 | ▶ | if( !$no_desc ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 269 | my $padname = $padcv->padname( $idx ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 269 | ▶ | $name = $padname ? $padname->name : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 269 | ▶ | if( $name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 79 | $name = "the lexical " . Devel::MAT::Cmd->format_note( $name, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 190 | $name = "pad temporary $idx"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 82477 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 82477 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | Devel::MAT::SV::Reference( $name, strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 82477 | ▶ | if( $match & STRENGTH_INDIRECT and $sv->type eq "REF" and !$sv->{magic} and my $rv = $sv->rv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"}
$match & 4 and $sv->type eq "REF"
MC/DC25%1/4
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4
$sv->type eq "REF"
not $sv->{"magic"}
my $rv = $sv->rv
Truth table40%2/5
A and B and not(C) and D
A= $match & 4B= $sv->type eq "REF"C= not $sv->{"magic"}D= my $rv = $sv->rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | 465 | ▶ | push @outrefs, $no_desc ? ( indirect => $rv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | Devel::MAT::SV::Reference( $name . " via RV", indirect => $rv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 10550 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | package Devel::MAT::SV::HASH 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 10 | __PACKAGE__->register_type( 5 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 10 | ▶ | use constant basetype => "HV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | =head1 Devel::MAT::SV::HASH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | Represents a hash; an SV of type C<SVt_PVHV>. The C<Devel::MAT::SV::STASH> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | subclass is used to represent hashes that are used as stashes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 18071 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 18071 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 18071 | ( my $n ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | unpack "$df->{uint_fmt} a*", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | 18071 | my $df_has_hek_ptr = $df->{format_minor} >= 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 18071 | my %values_at; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 18071 | foreach ( 1 .. $n ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 294428 | my $key = $df->_read_str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 294428 | ▶ | my $hek_ptr = $df_has_hek_ptr ? $df->_read_ptr : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 294428 | $values_at{$key} = [ $hek_ptr, $df->_read_ptr ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | $self->_set_hash_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 18071 | $ptrs->[0], # BACKREFS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | \%values_at, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | # Back-compat. for loading old .pmat files that didn't store AvREAL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 18071 | ▶ | sub _fixup ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fixup: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 18071 | ▶ | if( my $backrefs = $self->backrefs ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 3258 | ▶ | $backrefs->_set_backrefs( 1 ) if $backrefs->type eq "ARRAY"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 1 | ▶ | sub _more_saved ( $self, $keyaddr, $valaddr ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_more_saved: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 1 | push $self->{saved}->@*, [ $keyaddr, $valaddr ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 3 | ▶ | sub symname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
symname: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 3 | ▶ | return unless my $glob_at = $self->glob_at; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 3 | return $mksymname->( '%', $self->df->sv_at( $glob_at ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | # HVs have a backrefs field directly, rather than using magic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 35365 | ▶ | sub backrefs ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
backrefs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 35365 | return $self->df->sv_at( $self->backrefs_at ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | =head2 keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | @keys = $hv->keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | Returns the set of keys present in the hash, as plain perl strings, in no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | particular order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | # XS accessor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | =head2 value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | $sv = $hv->value( $key ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | Returns the SV associated with the given key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 10487 | ▶ | sub value ( $self, $key ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 10487 | return $self->df->sv_at( $self->value_at( $key ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | =head2 values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | @svs = $hv->values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | Returns all of the SVs stored as values, in no particular order (though, in an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | order corresponding to the order returned by C<keys>). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 637 | ▶ | sub values ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
values: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 637 | ▶ | return $self->n_values if !wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 637 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 637 | return map { $df->sv_at( $_ ) } $self->values_at; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 4517 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 4517 | ▶ | my $named = $self->{name} ? " named $self->{name}" : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 4517 | return "HASH(" . $self->n_values . ")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 10321 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=23 SCAR=32.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 10321 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 10321 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 10321 | ▶ | if( my $backrefs = $self->backrefs ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | # backrefs are optimised so if there's only one backref, it is stored | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | # in the backrefs slot directly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 6557 | ▶ | if( $backrefs->type eq "ARRAY" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 6547 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 6547 | ▶ | push @outrefs, $no_desc ? ( strong => $backrefs ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | Devel::MAT::SV::Reference( "the backrefs list", strong => $backrefs ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 6547 | ▶ | if( $match & STRENGTH_INDIRECT ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 6547 | foreach my $sv ( $self->backrefs->elems ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 6894211 | ▶ | push @outrefs, $no_desc ? ( indirect => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | Devel::MAT::SV::Reference( "a backref", indirect => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 10 | ▶ | if( $match & STRENGTH_WEAK ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 10 | ▶ | push @outrefs, $no_desc ? ( weak => $backrefs ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | Devel::MAT::SV::Reference( "a backref", weak => $backrefs ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 10321 | foreach my $key ( $self->keys ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 2906411 | ▶ | my $sv = $df->sv_at( $self->value_at( $key ) ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 2878834 | ▶ | my $name = $no_desc ? undef : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | "value " . Devel::MAT::Cmd->format_value( $key, key => 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 2878834 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 2878834 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | Devel::MAT::SV::Reference( $name, strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 2878834 | ▶ | if( $match & STRENGTH_INDIRECT and $sv->type eq "REF" and !$sv->{magic} and my $rv = $sv->rv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"}
$match & 4 and $sv->type eq "REF"
MC/DC25%1/4
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4
$sv->type eq "REF"
not $sv->{"magic"}
my $rv = $sv->rv
Truth table40%2/5
A and B and not(C) and D
A= $match & 4B= $sv->type eq "REF"C= not $sv->{"magic"}D= my $rv = $sv->rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 7213 | ▶ | push @outrefs, $no_desc ? ( indirect => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | Devel::MAT::SV::Reference( $name . " via RV", indirect => $rv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 10321 | foreach my $saved ( $self->{saved}->@* ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 1 | my $keysv = $self->df->sv_at( $saved->[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 1 | my $valsv = $self->df->sv_at( $saved->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 1 | ▶ | push @outrefs, $no_desc ? ( inferred => $keysv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | Devel::MAT::SV::Reference( "a key for saved value", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | inferred => $keysv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 1 | ▶ | push @outrefs, $no_desc ? ( inferred => $valsv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | Devel::MAT::SV::Reference( "saved value of value " . Devel::MAT::Cmd->format_value( $keysv->pv, key => 1 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | inferred => $valsv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 10321 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | package Devel::MAT::SV::STASH 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | 10 | ▶ | use base qw( Devel::MAT::SV::HASH ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 10 | __PACKAGE__->register_type( 6 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | =head1 Devel::MAT::SV::STASH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | Represents a hash used as a stash; an SV of type C<SVt_PVHV> whose C<HvNAME()> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | is non-NULL. This is a subclass of C<Devel::MAT::SV::HASH>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 3402 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | 3402 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 3402 | my ( $hash_bytes, $hash_ptrs, $hash_strs ) = $df->{sv_sizes}[5]->@*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 3402 | $self->SUPER::load( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | substr( $header, 0, $hash_bytes, "" ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | [ splice @$ptrs, 0, $hash_ptrs ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | [ splice @$strs, 0, $hash_strs ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 3402 | @{$self}{qw( mro_linearall_at mro_linearcurrent_at mro_nextmethod_at mro_isa_at )} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | @$ptrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 3402 | ( $self->{name} ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | @$strs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | =head2 mro_linear_all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | =head2 mro_linearcurrent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | =head2 mro_nextmethod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | =head2 mro_isa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | $hv = $stash->mro_linear_all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | $sv = $stash->mro_linearcurrent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | $sv = $stash->mro_nextmethod; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | $av = $stash->mro_isa; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | Returns the fields from the MRO structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 7018 | ▶ | sub mro_linearall ( $self ) { $self->df->sv_at( $self->{mro_linearall_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mro_linearall: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | 7018 | ▶ | sub mro_linearcurrent ( $self ) { $self->df->sv_at( $self->{mro_linearcurrent_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mro_linearcurrent: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 7018 | ▶ | sub mro_nextmethod ( $self ) { $self->df->sv_at( $self->{mro_nextmethod_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mro_nextmethod: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 7018 | ▶ | sub mro_isa ( $self ) { $self->df->sv_at( $self->{mro_isa_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mro_isa: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | =head2 value_code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | $cv = $stash->value_code( $key ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | Returns the CODE associated with the given symbol name, if it exists, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | C<undef> if not. This is roughly equivalent to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | $cv = $stash->value( $key )->code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | Except that it is aware of the direct reference to CVs that perl 5.22 will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | optimise for. This method should be used in preference to the above construct. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 1 | ▶ | sub value_code ( $self, $key ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value_code: called CC=4 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 1 | ▶ | my $sv = $self->value( $key ) or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 1 | ▶ | if( $sv->type eq "GLOB" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 1 | return $sv->code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | elsif( $sv->type eq "REF" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 0 | return $sv->rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 0 | die "TODO: value_code on non-GLOB, non-REF ${\ $sv->desc }"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | =head2 stashname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | $name = $stash->stashname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | Returns the name of the stash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 30 | ▶ | sub stashname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stashname: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 30 | return $self->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | 851 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 851 | my $desc = $self->SUPER::desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 851 | $desc =~ s/^HASH/STASH/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 851 | return $desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | 6593 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=10 SCAR=25.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 6593 | my @outrefs = $self->SUPER::_outrefs( $match, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 6593 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 6593 | ▶ | if( my $sv = $self->mro_linearall ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | Devel::MAT::SV::Reference( "the mro linear all HV", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 6593 | ▶ | if( my $sv = $self->mro_linearcurrent ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 1890 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | Devel::MAT::SV::Reference( "the mro linear current", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 6593 | ▶ | if( my $sv = $self->mro_nextmethod ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | Devel::MAT::SV::Reference( "the mro next::method", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | 6593 | ▶ | if( my $sv = $self->mro_isa ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | 1889 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | Devel::MAT::SV::Reference( "the mro ISA cache", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 6593 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | package Devel::MAT::SV::CODE 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | 10 | __PACKAGE__->register_type( 7 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 10 | ▶ | use constant basetype => "CV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 10 | ▶ | use List::Util 1.44 qw( uniq ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 10 | ▶ | use Struct::Dumb 0.07 qw( struct ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 10 | struct Padname => [qw( name ourstash flags fieldix fieldstash_at )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | 0 | ▶ | *{__PACKAGE__."::Padname::is_outer"} = sub ( $pn ) { $pn->flags & 0x01 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | 0 | ▶ | *{__PACKAGE__."::Padname::is_state"} = sub ( $pn ) { $pn->flags & 0x02 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | 0 | ▶ | *{__PACKAGE__."::Padname::is_lvalue"} = sub ( $pn ) { $pn->flags & 0x04 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | 0 | ▶ | *{__PACKAGE__."::Padname::is_typed"} = sub ( $pn ) { $pn->flags & 0x08 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | 0 | ▶ | *{__PACKAGE__."::Padname::is_our"} = sub ( $pn ) { $pn->flags & 0x10 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | # Internal flags, not appearing in the file itself | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | ▶ | *{__PACKAGE__."::Padname::is_field"} = sub ( $pn ) { $pn->flags & 0x100 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | =head1 Devel::MAT::SV::CODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | Represents a function or closure; an SV of type C<SVt_PVCV>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 68404 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=15 SCAR=28.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 68404 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 68404 | my ( $line, $flags, $oproot, $depth, $name_hek ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | unpack "$df->{uint_fmt} C $df->{ptr_fmt} $df->{u32_fmt} $df->{ptr_fmt}", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | 68404 | ▶ | defined $depth or $depth = -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | 68404 | ▶ | $name_hek //= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$name_hek //= 0
MC/DC0%0/1
$name_hek //= 0
$name_hek
Truth table50%1/2
A
A= $name_hek
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | $self->_set_code_fields( $line, $flags, $oproot, $depth, $name_hek, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | 68404 | @{$ptrs}[0, 2..4], # STASH, OUTSIDE, PADLIST, CONSTVAL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 68404 | @{$strs}[0, 1], # FILE, NAME | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | 68404 | $self->_set_glob_at( $ptrs->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | # After perl 5.20 individual padname structs are no longer arena-allocated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 68404 | ▶ | $self->{padnames} = [] if $df->{perlver} > ( ( 5 << 24 ) | ( 20 << 16 ) | 0xffff ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | 68404 | ▶ | while( my $type = $df->_read_u8 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | match( $type : == ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | 162168 | ▶ | case( 1 ) { push $self->{consts_at}->@*, $df->_read_ptr } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | 0 | ▶ | case( 2 ) { push $self->{constix}->@*, $df->_read_uint } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 63017 | ▶ | case( 3 ) { push $self->{gvs_at}->@*, $df->_read_ptr } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | 0 | ▶ | case( 4 ) { push $self->{gvix}->@*, $df->_read_uint } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | 319464 | case( 5 ) { my $padix = $df->_read_uint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 319464 | ▶ | $self->{padnames}[$padix] = _load_padname( $df ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | case( 6 ) { # ignore - used to be padsvs_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | 0 | ▶ | $df->_read_uint; $df->_read_uint; $df->_read_ptr; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 41891 | ▶ | case( 7 ) { $self->_set_padnames_at( $df->_read_ptr ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 42163 | case( 8 ) { my $depth = $df->_read_uint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 42163 | ▶ | $self->{pads_at}[$depth] = $df->_read_ptr; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | 58742 | case( 9 ) { my $padname = $self->{padnames}[ $df->_read_uint ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | 58742 | ▶ | $padname->flags = $df->_read_u8; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 227 | case( 10 ) { my $padname = $self->{padnames}[ $df->_read_uint ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | 227 | $padname->flags |= 0x100; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | 227 | $padname->fieldix = $df->_read_uint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | 227 | $padname->fieldstash_at = $df->_read_ptr; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 687672 | ▶ | default { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | 0 | die "TODO: unhandled CODEx type $type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | 319464 | ▶ | sub _load_padname ( $df ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_padname: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | 319464 | return Padname( $df->_read_str, $df->_read_ptr, 0, 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 68404 | ▶ | sub _fixup ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fixup: called CC=18 SCAR=41.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 68404 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 68404 | my $padlist = $self->padlist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | 68404 | ▶ | if( $padlist ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 0 | bless $padlist, "Devel::MAT::SV::PADLIST"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 0 | $padlist->_set_padcv_at( $self->addr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 68404 | my $padnames; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | my @pads; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | # 5.18.0 onwards has a totally different padlist arrangement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | 68404 | ▶ | if( $df->{perlver} >= ( ( 5 << 24 ) | ( 18 << 16 ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 68404 | $padnames = $self->padnames_av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | 68404 | @pads = map { $df->sv_at( $_ ) } $self->{pads_at}->@*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | 68404 | shift @pads; # always zero | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | elsif( $padlist ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | # PADLIST[0] stores the names of the lexicals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | # The rest stores the actual pads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | 0 | ( $padnames, @pads ) = $padlist->elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 0 | $self->_set_padnames_at( $padnames->addr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | 68404 | ▶ | if( $padnames ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | 0 | bless $padnames, "Devel::MAT::SV::PADNAMES"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 0 | $padnames->_set_padcv_at( $self->addr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 0 | $self->{padnames} = \my @padnames; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | 0 | foreach my $padix ( 1 .. $padnames->elems - 1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | 0 | ▶ | my $padnamesv = $padnames->elem( $padix ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | 0 | ▶ | $padnamesv->immortal and next; # UNDEF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | 0 | $padnames[$padix] = Padname( $padnamesv->pv, $padnamesv->ourstash, 0, 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | 68404 | foreach my $pad ( @pads ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | 42163 | ▶ | next unless $pad; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | 42147 | bless $pad, "Devel::MAT::SV::PAD"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | 42147 | $pad->_set_padcv_at( $self->addr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 68404 | $self->{pads} = \@pads; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | # Under ithreads, constants and captured GVs are actually stored in the first padlist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 68404 | ▶ | if( $df->ithreads ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | my $pad0 = $pads[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 0 | foreach my $type (qw( const gv )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 0 | ▶ | my $idxes = $self->{"${type}ix"} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | ▶ | my $svs_at = $self->{"${type}s_at"} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$self{"${type}s_at"} ||= []
MC/DC0%0/1
$$self{"${type}s_at"} ||= []
$$self{"${type}s_at"}
Truth table0%0/2
A
A= $$self{"${type}s_at"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | 0 | @$svs_at = map { my $e = $pad0->elem($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 0 | ▶ | $e ? $e->addr : undef } uniq @$idxes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 68404 | ▶ | if( $self->is_cloned and my $oproot = $self->oproot ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->is_cloned and my $oproot = $self->oproot
MC/DC50%1/2
$self->is_cloned and my $oproot = $self->oproot
$self->is_cloned
my $oproot = $self->oproot
Truth table66%2/3
A and B
A= $self->is_clonedB= my $oproot = $self->oproot
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 5779 | ▶ | if( my $protosub = $df->{protosubs_by_oproot}{$oproot} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | 5771 | $self->_set_protosub_at( $protosub->addr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | =head2 stash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | =head2 glob | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | =head2 file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | =head2 line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | =head2 scope | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | =head2 padlist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | =head2 constval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | =head2 oproot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | =head2 depth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | $stash = $cv->stash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | $gv = $cv->glob; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | $filename = $cv->file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | $line = $cv->line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | $scope_cv = $cv->scope; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | $av = $cv->padlist; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | $sv = $cv->constval; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | $addr = $cv->oproot; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | $depth = $cv->depth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | Returns the stash, glob, filename, line number, scope, padlist, constant value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | oproot or depth of the code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 20954 | ▶ | sub stash ( $self ) { $self->df->sv_at( $self->stash_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 20979 | ▶ | sub glob ( $self ) { $self->df->sv_at( $self->glob_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
glob: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | # XS accessors: file, line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 28008 | ▶ | sub scope ( $self ) { $self->df->sv_at( $self->outside_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scope: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | 96412 | ▶ | sub padlist ( $self ) { $self->df->sv_at( $self->padlist_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padlist: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | 45107 | ▶ | sub constval ( $self ) { $self->df->sv_at( $self->constval_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
constval: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | # XS accessors: oproot, depth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | =head2 location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | $location = $cv->location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | Returns C<FILE line LINE> if the line is defined, or C<FILE> if not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | 0 | ▶ | sub location ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | 0 | my $line = $self->line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | # line 0 is invalid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | 0 | ▶ | return $line ? "$file line $line" : $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | =head2 is_clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | =head2 is_cloned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | =head2 is_xsub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | =head2 is_weakoutside | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | =head2 is_cvgv_rc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | =head2 is_lexical | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | $clone = $cv->is_clone; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | $cloned = $cv->is_cloned; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | $xsub = $cv->is_xsub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | $weak = $cv->is_weakoutside; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | $rc = $cv->is_cvgv_rc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | $lexical = $cv->is_lexical; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | Returns the C<CvCLONE()>, C<CvCLONED()>, C<CvISXSUB()>, C<CvWEAKOUTSIDE()>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | C<CvCVGV_RC()> and C<CvLEXICAL()> flags. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | # XS accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | =head2 protosub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | $protosub = $cv->protosub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | Returns the protosub CV, if known, for a closure CV. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | 20955 | ▶ | sub protosub ( $self ) { $self->df->sv_at( $self->protosub_at ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
protosub: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | =head2 constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | @svs = $cv->constants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | Returns a list of the SVs used as constants or method names in the code. On | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | ithreads perl the constants are part of the padlist structure so this list is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | constructed from parts of the padlist at loading time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | 28009 | ▶ | sub constants ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
constants: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 28009 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | 28009 | ▶ | return map { $df->sv_at($_) } ( $self->{consts_at} || [] )->@*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'consts_at'} || []
MC/DC100%1/1
$self->{'consts_at'} || []
$self->{'consts_at'}
Truth table100%2/2
A
A= $self->{'consts_at'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | =head2 globrefs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | @svs = $cv->globrefs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | Returns a list of the SVs used as GLOB references in the code. On ithreads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | perl the constants are part of the padlist structure so this list is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | constructed from parts of the padlist at loading time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 28008 | ▶ | sub globrefs ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
globrefs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 28008 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | 28008 | return map { $df->sv_at($_) } $self->{gvs_at}->@*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 0 | ▶ | sub stashname ( $self ) { $self->stash ? $self->stash->stashname : undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stashname: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 25 | ▶ | sub symname ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
symname: called CC=3 SCAR=12.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | # CvLEXICALs or CVs with non-reified CvGVs may still have a hekname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | 25 | ▶ | if( defined( my $hekname = $self->hekname ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | 0 | my $stashname = $self->stashname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | 0 | $stashname =~ s/^main:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | 0 | return '&' . $stashname . "::" . $hekname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | elsif( my $glob = $self->glob ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | 24 | return '&' . $glob->stashname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 1 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | =head2 padname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | $padname = $cv->padname( $padix ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | Returns the name of the $padix'th lexical variable, or C<undef> if it doesn't | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | have a name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | The returned padname is a structure of the following fields: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | $name = $padname->name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | $bool = $padname->is_outer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | $bool = $padname->is_state; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | $bool = $padname->is_lvalue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | $bool = $padname->is_typed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | $bool = $padname->is_our; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | $bool = $padname->is_field; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | 270 | ▶ | sub padname ( $self, $padix ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padname: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | 270 | return $self->{padnames}[$padix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | =head2 padix_from_padname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | $padix = $cv->padix_from_padname( $padname ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | Returns the index of the first lexical variable with the given pad name, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | C<undef> if one does not exist. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | 6 | ▶ | sub padix_from_padname ( $self, $padname ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padix_from_padname: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 6 | my $padnames = $self->{padnames}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | 6 | foreach my $padix ( 1 .. $#$padnames ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | 36 | my $thisname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | 36 | ▶ | return $padix if defined $padnames->[$padix] and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $padnames->[$padix] and defined($thisname = $padnames->[$padix]->name) and $thisname eq $padname
defined $padnames->[$padix] and defined($thisname = $padnames->[$padix]->name)
MC/DC66%2/3
defined $padnames->[$padix] and defined($thisname = $padnames->[$padix]->name) and $thisname eq $padname
defined $padnames->[$padix]
defined($thisname = $padnames->[$padix]->name)
$thisname eq $padname
Truth table75%3/4
A and B and C
A= defined $padnames->[$padix]B= defined($thisname = $padnames->[$padix]->name)C= $thisname eq $padname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | defined( $thisname = $padnames->[$padix]->name ) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | $thisname eq $padname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | =head2 max_padix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | $max_padix = $cv->max_padix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | Returns the maximum valid pad index. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | This is typically used to create a list of potential pad indexes, such as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | 0 .. $cv->max_padix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | Note that since pad slots may contain things other than lexical variables, not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | every pad slot between 0 and this index will necessarily contain a lexical | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | variable or have a pad name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | 1 | ▶ | sub max_padix ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_padix: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | 1 | return $#{ $self->{padnames} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | =head2 padnames_av | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | $padnames_av = $cv->padnames_av; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | Returns the AV reference directly which stores the pad names. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | After perl version 5.20, this is no longer used directly and will return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | C<undef>. The individual pad names themselves can still be found via the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | C<padname> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | 96412 | ▶ | sub padnames_av ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
padnames_av: called CC=3 SCAR=17.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | 96412 | ▶ | return $self->df->sv_at( $self->padnames_at or return undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$self->df->sv_at($self->padnames_at || (return undef)) // croak("${\$self->desc;} PADNAMES is not accessible")
$self->padnames_at || (return undef)
MC/DC0%0/1
$self->df->sv_at($self->padnames_at || (return undef)) // croak("${\$self->desc;} PADNAMES is not accessible")
$self->df->sv_at($self->padnames_at || (return undef))
MC/DC0%0/1
$self->padnames_at || (return undef)
$self->padnames_at
Truth table0%0/2
A
A= $self->df->sv_at($self->padnames_at || (return undef))
Truth table50%1/2
A
A= $self->padnames_at
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | 0 | // croak "${\ $self->desc } PADNAMES is not accessible"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | =head2 pads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | @pads = $cv->pads; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | Returns a list of the actual pad AVs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | 7054 | ▶ | sub pads ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pads: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 7054 | ▶ | return $self->{pads} ? $self->{pads}->@* : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | =head2 pad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | $pad = $cv->pad( $depth ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | Returns the PAD at the given depth (given by 1-based index). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | 8 | ▶ | sub pad ( $self, $depth ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pad: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | 8 | ▶ | return $self->{pads} ? $self->{pads}[$depth-1] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | =head2 maybe_lexvar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | $sv = $cv->maybe_lexvar( $padname, $depth ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | I<Since version 0.49.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | Returns the SV on the PAD associated with the given padname, at the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | optionally-given depth (1-based index). If I<$depth> is not provided, the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | topmost live PAD will be used. If no variable exists of the given name returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | C<undef>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | Used to be called C<lexvar>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | 4 | ▶ | sub maybe_lexvar ( $self, $padname, $depth = undef ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maybe_lexvar: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | 4 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | 4 | ▶ | $depth //= $self->depth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$depth //= $self->depth
MC/DC0%0/2
$depth //= $self->depth
$depth
$self->depth
Truth table66%2/3
A //= B
A= $depthB= $self->depth
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | 4 | ▶ | $depth or croak "Cannot fetch current pad of a non-live CODE"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | 4 | return $self->pad( $depth )->maybe_lexvar( $padname ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | 10 | *lexvar = \&maybe_lexvar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | 17099 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | 17099 | my @flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | 17099 | ▶ | push @flags, "PP" if $self->oproot; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | 17099 | ▶ | push @flags, "CONST" if $self->constval; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | 17099 | ▶ | push @flags, "XS" if $self->is_xsub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | 17099 | ▶ | push @flags, "closure" if $self->is_cloned; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | 17099 | ▶ | push @flags, "proto" if $self->is_clone; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | 17099 | local $" = ","; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | 17099 | return "CODE(@flags)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | 20954 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=41 SCAR=40.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | 20954 | my $pads = $self->{pads}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | 20954 | ▶ | my $maxdepth = $pads ? scalar @$pads : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | 20954 | my $have_padlist = defined $self->padlist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | 20954 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | 20954 | my $is_weakoutside = $self->is_weakoutside; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | 20954 | ▶ | if( $match & ( $is_weakoutside ? STRENGTH_WEAK : STRENGTH_STRONG ) and my $scope = $self->scope ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$match & ($is_weakoutside ? 2 : 1) and my $scope = $self->scope
MC/DC50%1/2
$match & ($is_weakoutside ? 2 : 1) and my $scope = $self->scope
$match & ($is_weakoutside ? 2 : 1)
my $scope = $self->scope
Truth table66%2/3
A and B
A= $match & ($is_weakoutside ? 2 : 1)B= my $scope = $self->scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | 10060 | ▶ | my $strength = $is_weakoutside ? "weak" : "strong"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | 10060 | ▶ | push @outrefs, $no_desc ? ( $strength => $scope ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | Devel::MAT::SV::Reference( "the scope", $strength => $scope ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | 20954 | ▶ | if( $match & STRENGTH_WEAK and my $stash = $self->stash ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$match & 2 and my $stash = $self->stash
MC/DC50%1/2
$match & 2 and my $stash = $self->stash
$match & 2
my $stash = $self->stash
Truth table66%2/3
A and B
A= $match & 2B= my $stash = $self->stash
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | 17895 | ▶ | push @outrefs, $no_desc ? ( weak => $stash ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | Devel::MAT::SV::Reference( "the stash", weak => $stash ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | 20954 | my $is_strong_gv = $self->is_cvgv_rc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | 20954 | ▶ | if( $match & ( $is_strong_gv ? STRENGTH_STRONG : STRENGTH_WEAK ) and my $glob = $self->glob ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$match & ($is_strong_gv ? 1 : 2) and my $glob = $self->glob
MC/DC50%1/2
$match & ($is_strong_gv ? 1 : 2) and my $glob = $self->glob
$match & ($is_strong_gv ? 1 : 2)
my $glob = $self->glob
Truth table66%2/3
A and B
A= $match & ($is_strong_gv ? 1 : 2)B= my $glob = $self->glob
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | 20440 | ▶ | my $strength = $is_strong_gv ? "strong" : "weak"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | 20440 | ▶ | push @outrefs, $no_desc ? ( $strength => $glob ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | Devel::MAT::SV::Reference( "the glob", $strength => $glob ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | 20954 | ▶ | if( $match & STRENGTH_STRONG and my $constval = $self->constval ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$match & 1 and my $constval = $self->constval
MC/DC50%1/2
$match & 1 and my $constval = $self->constval
$match & 1
my $constval = $self->constval
Truth table66%2/3
A and B
A= $match & 1B= my $constval = $self->constval
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | 8014 | ▶ | push @outrefs, $no_desc ? ( strong => $constval ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | Devel::MAT::SV::Reference( "the constant value", strong => $constval ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | 20954 | ▶ | if( $match & STRENGTH_INFERRED and my $protosub = $self->protosub ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$match & 8 and my $protosub = $self->protosub
MC/DC50%1/2
$match & 8 and my $protosub = $self->protosub
$match & 8
my $protosub = $self->protosub
Truth table66%2/3
A and B
A= $match & 8B= my $protosub = $self->protosub
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | 1444 | ▶ | push @outrefs, $no_desc ? ( inferred => $protosub ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | Devel::MAT::SV::Reference( "the protosub", inferred => $protosub ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | # Under ithreads, constants and captured GVs are actually stored in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | # first padlist, so they're only here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | 20954 | my $ithreads = $self->df->ithreads; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | 20954 | ▶ | if( $match & ( $ithreads ? STRENGTH_INDIRECT : STRENGTH_STRONG ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | 20954 | ▶ | my $strength = $ithreads ? "indirect" : "strong"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | 20954 | foreach my $sv ( $self->constants ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | 40754 | ▶ | $sv or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | 40754 | ▶ | push @outrefs, $no_desc ? ( $strength => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | Devel::MAT::SV::Reference( "a constant", $strength => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | 20954 | foreach my $sv ( $self->globrefs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | 15841 | ▶ | $sv or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | 15841 | ▶ | push @outrefs, $no_desc ? ( $strength => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | Devel::MAT::SV::Reference( "a referenced glob", $strength => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | 20954 | ▶ | if( $match & STRENGTH_STRONG and $have_padlist ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$match & 1 and $have_padlist
MC/DC0%0/2
$match & 1 and $have_padlist
$match & 1
$have_padlist
Truth table33%1/3
A and B
A= $match & 1B= $have_padlist
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $self->padlist ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | Devel::MAT::SV::Reference( "the padlist", strong => $self->padlist ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | # If we have a PADLIST then its contents are indirect; if not then they | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | # are direct strong | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | 20954 | ▶ | if( $match & ( $have_padlist ? STRENGTH_INDIRECT : STRENGTH_STRONG ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | 20954 | ▶ | my $strength = $have_padlist ? "indirect" : "strong"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | 20954 | ▶ | if( my $padnames_av = $self->padnames_av ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | 0 | ▶ | push @outrefs, $no_desc ? ( $strength => $padnames_av ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | Devel::MAT::SV::Reference( "the padnames", $strength => $padnames_av ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | 20954 | foreach my $depth ( 1 .. $maxdepth ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | 10583 | ▶ | my $pad = $pads->[$depth-1] or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | 10579 | ▶ | push @outrefs, $no_desc ? ( $strength => $pad ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | Devel::MAT::SV::Reference( "pad at depth $depth", $strength => $pad ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | 20954 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | package Devel::MAT::SV::IO 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | 10 | __PACKAGE__->register_type( 8 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | 10 | ▶ | use constant basetype => "IO"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | =head1 Devel::MAT::SV::IO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | Represents an IO handle; an SV type of C<SVt_PVIO>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | 96 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | 96 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | 96 | @{$self}{qw( ifileno ofileno )} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | unpack "$df->{uint_fmt}2", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | defined $_ and $_ == $df->{minus_1} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | 96 | ▶ | $_ = -1 for @{$self}{qw( ifileno ofileno )}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $_ and $_ == $df->{"minus_1"}
MC/DC50%1/2
defined $_ and $_ == $df->{"minus_1"}
defined $_
$_ == $df->{"minus_1"}
Truth table66%2/3
A and B
A= defined $_B= $_ == $df->{"minus_1"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | 96 | @{$self}{qw( topgv_at formatgv_at bottomgv_at )} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | @$ptrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | =head2 ifileno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | =head2 ofileno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | $ifileno = $io->ifileno; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | $ofileno = $io->ofileno; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | Returns the input or output file numbers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | 0 | ▶ | sub ifileno ( $self ) { $self->{ifileno} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ifileno: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | 1 | ▶ | sub ofileno ( $self ) { $self->{ofileno} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ofileno: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | 24 | ▶ | sub topgv ( $self ) { $self->df->sv_at( $self->{topgv_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
topgv: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | 24 | ▶ | sub formatgv ( $self ) { $self->df->sv_at( $self->{formatgv_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
formatgv: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | 24 | ▶ | sub bottomgv ( $self ) { $self->df->sv_at( $self->{bottomgv_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bottomgv: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | 24 | ▶ | sub desc ( $ ) { "IO()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | 24 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=8 SCAR=29.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | 24 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | 24 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | 24 | ▶ | if( my $gv = $self->topgv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $gv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | Devel::MAT::SV::Reference( "the top GV", strong => $gv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | 24 | ▶ | if( my $gv = $self->formatgv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $gv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | Devel::MAT::SV::Reference( "the format GV", strong => $gv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | 24 | ▶ | if( my $gv = $self->bottomgv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $gv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | Devel::MAT::SV::Reference( "the bottom GV", strong => $gv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | 24 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | package Devel::MAT::SV::LVALUE 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | 10 | __PACKAGE__->register_type( 9 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | 10 | ▶ | use constant basetype => "LV"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | 1 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | 1 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2364 | 1 | ( $self->{type}, $self->{off}, $self->{len} ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2365 | unpack "a1 $df->{uint_fmt}2", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2367 | 1 | ( $self->{targ_at} ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2368 | @$ptrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2371 | 1 | ▶ | sub lvtype ( $self ) { $self->{type} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lvtype: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2372 | 0 | ▶ | sub off ( $self ) { $self->{off} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
off: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2373 | 0 | ▶ | sub len ( $self ) { $self->{len} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
len: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2374 | 0 | ▶ | sub target ( $self ) { $self->df->sv_at( $self->{targ_at} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
target: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2376 | 0 | ▶ | sub desc ( $ ) { "LVALUE()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2378 | 0 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2379 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2380 | 0 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2382 | 0 | ▶ | if( $match & STRENGTH_STRONG and my $sv = $self->target ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$match & 1 and my $sv = $self->target
MC/DC0%0/2
$match & 1 and my $sv = $self->target
$match & 1
my $sv = $self->target
Truth table0%0/3
A and B
A= $match & 1B= my $sv = $self->target
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2383 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2384 | Devel::MAT::SV::Reference( "the target", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2387 | 0 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2390 | package Devel::MAT::SV::REGEXP 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2391 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2392 | 10 | ▶ | use constant basetype => "REGEXP"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2393 | 10 | __PACKAGE__->register_type( 10 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2395 | sub load ( @ ) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2397 | 2043 | ▶ | sub desc ( $ ) { "REGEXP()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2399 | 2046 | ▶ | sub _outrefs ( @ ) { () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2401 | package Devel::MAT::SV::FORMAT 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2402 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2403 | 10 | ▶ | use constant basetype => "PVFM"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2404 | 10 | __PACKAGE__->register_type( 11 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2406 | sub load ( @ ) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2408 | 0 | ▶ | sub desc ( $ ) { "FORMAT()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2410 | 0 | ▶ | sub _outrefs ( @ ) { () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2412 | package Devel::MAT::SV::INVLIST 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2413 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2414 | 10 | ▶ | use constant basetype => "INVLIST"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2415 | 10 | __PACKAGE__->register_type( 12 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2417 | sub load ( @ ) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2419 | 230 | ▶ | sub desc ( $ ) { "INVLIST()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2421 | 244 | ▶ | sub _outrefs ( @ ) { () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2423 | # A hack to compress files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2424 | package Devel::MAT::SV::_UNDEFSV 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2425 | 10 | ▶ | use base qw( Devel::MAT::SV::SCALAR ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2426 | 10 | __PACKAGE__->register_type( 13 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2428 | 306717 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2429 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2430 | 306717 | bless $self, "Devel::MAT::SV::SCALAR"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2432 | 306717 | $self->_set_scalar_fields( 0, 0, 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2433 | "", 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2434 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2435 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2438 | package Devel::MAT::SV::_YESSV 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2439 | 10 | ▶ | use base qw( Devel::MAT::SV::BOOL ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2440 | 10 | __PACKAGE__->register_type( 14 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2442 | 120 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2443 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2444 | 120 | bless $self, "Devel::MAT::SV::BOOL"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2446 | 120 | $self->_set_scalar_fields( 0x01, 1, 1.0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2447 | "1", 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2448 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2449 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2452 | package Devel::MAT::SV::_NOSV 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2453 | 10 | ▶ | use base qw( Devel::MAT::SV::BOOL ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2454 | 10 | __PACKAGE__->register_type( 15 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2456 | 96 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2457 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2458 | 96 | bless $self, "Devel::MAT::SV::BOOL"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2460 | 96 | $self->_set_scalar_fields( 0x01, 0, 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2461 | "", 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2462 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2463 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2466 | package Devel::MAT::SV::OBJECT 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2467 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2468 | 10 | __PACKAGE__->register_type( 16 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2469 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2470 | 10 | ▶ | use constant basetype => "OBJ"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2472 | =head1 Devel::MAT::SV::OBJECT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2474 | Represents an object instance; an SV of type C<SVt_PVOBJ>. These are only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2475 | present in files from perls with C<feature 'class'>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2477 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2479 | 1 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2480 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2481 | 1 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2483 | 1 | my ( $n ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2484 | unpack "$df->{uint_fmt} a*", $header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2486 | 1 | ▶ | my @fields_at = $n ? $df->_read_ptrs( $n ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2487 | 1 | $self->_set_object_fields( \@fields_at ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2490 | =head2 fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2492 | @svs = $obj->fields; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2494 | Returns all the values of all the fields in a list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2496 | Note that to find the names of the fields you'll have to enquire with the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2497 | class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2499 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2501 | 0 | ▶ | sub fields ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fields: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2502 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2503 | 0 | my $n = $self->n_fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2504 | 0 | ▶ | return $n unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2506 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2507 | 0 | return map { $df->sv_at( $self->field_at( $_ ) ) } 0 .. $n-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2510 | =head2 field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2512 | $sv = $obj->field( $name_or_fieldix ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2514 | Returns the value of the given field; which may be specified by name or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2515 | index directly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2517 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2519 | 3 | ▶ | sub field ( $self, $name_or_fieldix ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
field: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2520 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2521 | 3 | my $fieldix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2522 | 3 | ▶ | if( $name_or_fieldix =~ m/^\d+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2523 | 0 | $fieldix = $name_or_fieldix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2525 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2526 | 3 | $fieldix = $self->blessed->field( $name_or_fieldix )->fieldix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2529 | 3 | return $self->df->sv_at( $self->field_at( $fieldix ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2532 | 1 | ▶ | sub desc ( $ ) { return "OBJ()"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2534 | 0 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2535 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2536 | 0 | my $n = $self->n_fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2538 | 0 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2540 | 0 | foreach my $field ( $self->blessed->fields ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2541 | 0 | ▶ | my $sv = $self->field( $field->fieldix ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2543 | 0 | ▶ | my $name = $no_desc ? undef : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2544 | "the " . Devel::MAT::Cmd->format_note( $field->name, 1 ) . " field"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2545 | 0 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2546 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2547 | Devel::MAT::SV::Reference( $name, strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2549 | 0 | ▶ | if( $match & STRENGTH_INDIRECT and $sv->type eq "REF" and !$sv->{magic} and my $rv = $sv->rv ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"}
$match & 4 and $sv->type eq "REF"
MC/DC0%0/4
$match & 4 and $sv->type eq "REF" and not $sv->{"magic"} and my $rv = $sv->rv
$match & 4
$sv->type eq "REF"
not $sv->{"magic"}
my $rv = $sv->rv
Truth table0%0/5
A and B and not(C) and D
A= $match & 4B= $sv->type eq "REF"C= not $sv->{"magic"}D= my $rv = $sv->rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2550 | 0 | ▶ | push @outrefs, $no_desc ? ( indirect => $rv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2551 | Devel::MAT::SV::Reference( $name . " via RV", indirect => $rv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2555 | 0 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2558 | package Devel::MAT::SV::CLASS 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2559 | 10 | ▶ | use base qw( Devel::MAT::SV::STASH ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2560 | 10 | __PACKAGE__->register_type( 17 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2561 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2563 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2565 | 10 | ▶ | use Struct::Dumb 0.07 qw( readonly_struct ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2566 | 10 | readonly_struct Field => [qw( fieldix name )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2568 | 10 | ▶ | use List::Util qw( first ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2570 | =head1 Devel::MAT::SV::CLASS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2572 | Represents a class; a sub-type of stash for implementing object classes. These | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2573 | are only present in files from perls with C<feature 'class'>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2575 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2577 | 49 | ▶ | sub load ( $self, $header, $ptrs, $strs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2578 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2579 | 49 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2581 | 49 | my ( $stash_bytes, $stash_ptrs, $stash_strs ) = $df->{sv_sizes}[6]->@*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2583 | 49 | $self->SUPER::load( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2584 | substr( $header, 0, $stash_bytes, "" ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2585 | [ splice @$ptrs, 0, $stash_ptrs ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2586 | [ splice @$strs, 0, $stash_strs ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2587 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2589 | 49 | @{$self}{qw( adjust_blocks_at )} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2590 | @$ptrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2592 | 49 | ▶ | while( my $type = $df->_read_u8 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2593 | match( $type : == ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2594 | 115 | case( 1 ) { push $self->{fields}->@*, [ $df->_read_uint, $df->_read_str ] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2595 | 115 | ▶ | default { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2596 | 0 | die "TODO: unhandled CLASSx type $type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2602 | 12 | ▶ | sub adjust_blocks ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
adjust_blocks: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2603 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2604 | 12 | return $self->df->sv_at( $self->{adjust_blocks_at} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2607 | =head2 fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2609 | @fields = $class->fields; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2611 | Returns a list of the field definitions of the class, in declaration order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2612 | Each is a structure whose form is given below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2614 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2616 | 4 | ▶ | sub fields ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fields: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2617 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2618 | 4 | return map { Field( @$_ ) } $self->{fields}->@*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2621 | =head2 field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2623 | $field = $class->field( $name_or_fieldix ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2625 | Returns the field definition of the given field; which may be specified by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2626 | name or index directly. Throws an exception if none such exists. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2628 | The returned field is a structure of the following fields: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2630 | $fieldix = $field->fieldix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2631 | $name = $field->name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2633 | =head2 maybe_field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2635 | $field = $class->maybe_field( $name_or_fieldix ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2637 | I<Since version 0.49.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2639 | Similar to L</field> but returns undef if none such exists. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2641 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2643 | 3 | ▶ | sub maybe_field ( $self, $name_or_fieldix ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maybe_field: called CC=2 SCAR=8.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2644 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2645 | 3 | ▶ | if( $name_or_fieldix =~ m/^\d+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2646 | 0 | ▶ | return first { $_->fieldix == $name_or_fieldix } $self->fields; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2648 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2649 | 3 | ▶ | return first { $_->name eq $name_or_fieldix } $self->fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2653 | 3 | ▶ | sub field ( $self, $name_or_fieldix ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
field: called CC=3 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2654 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2655 | 3 | ▶ | return $self->maybe_field( $name_or_fieldix ) // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->maybe_field($name_or_fieldix) // do {
croak("No field at index $name_or_fieldix") if $name_or_fieldix =~ /^\d+$/u;
croak("No field named '${name_or_fieldix}'")
}
MC/DC0%0/2
$self->maybe_field($name_or_fieldix) // do {
croak("No field at index $name_or_fieldix") if $name_or_fieldix =~ /^\d+$/u;
croak("No field named '${name_or_fieldix}'")
}
$self->maybe_field($name_or_fieldix)
do {
croak("No field at index $name_or_fieldix") if $name_or_fieldix =~ /^\d+$/u;
croak("No field named '${name_or_fieldix}'")
}
Truth table33%1/3
A // B
A= $self->maybe_field($name_or_fieldix)B= do {
croak("No field at index $name_or_fieldix") if $name_or_fieldix =~ /^\d+$/u;
croak("No field named '${name_or_fieldix}'")
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2656 | 0 | ▶ | croak "No field at index $name_or_fieldix" if $name_or_fieldix =~ m/^\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2657 | 0 | croak "No field named '$name_or_fieldix'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2658 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2661 | 12 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: called CC=4 SCAR=17.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2662 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2663 | 12 | my @outrefs = $self->SUPER::_outrefs( $match, $no_desc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2665 | 12 | ▶ | if( $match & STRENGTH_STRONG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2666 | 12 | ▶ | if( my $sv = $self->adjust_blocks ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2667 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2668 | Devel::MAT::SV::Reference( "the ADJUST blocks AV", strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2672 | 12 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2675 | # A "SV" type that isn't really an SV, but has many of the same methods. These | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2676 | # aren't created by core perl, but are used by XS extensions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2677 | package Devel::MAT::SV::C_STRUCT 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2678 | 10 | ▶ | use base qw( Devel::MAT::SV ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2679 | 10 | __PACKAGE__->register_type( 0x7F ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2680 | 10 | ▶ | use constant $CONSTANTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2681 | 10 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2682 | 10 | FIELD_PTR => 0x00, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2683 | FIELD_BOOL => 0x01, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2684 | FIELD_U8 => 0x02, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2685 | FIELD_U32 => 0x03, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2686 | FIELD_UINT => 0x04, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2687 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2688 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2689 | 10 | ▶ | use List::Util qw( first ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2691 | =head1 Devel::MAT::SV::C_STRUCT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2693 | Represents a C-level c<struct> type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2695 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2697 | 0 | ▶ | sub desc ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2698 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2699 | 0 | my $typename = $self->structtype->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2701 | 0 | "C_STRUCT($typename)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2704 | 0 | ▶ | sub load ( $self, $fields ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2705 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2706 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2708 | 0 | my @vals; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2710 | 0 | foreach my $field ( @$fields ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2711 | 0 | push @vals, my $type = $field->type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2713 | 0 | ▶ | if( $type == FIELD_PTR ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2714 | 0 | push @vals, $df->_read_ptr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2716 | ▶ | elsif( $type == FIELD_BOOL or $type == FIELD_U8 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type == 1 or $type == 2
MC/DC0%0/2
$type == 1 or $type == 2
$type == 1
$type == 2
Truth table0%0/3
A or B
A= $type == 1B= $type == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2717 | 0 | push @vals, $df->_read_u8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2719 | elsif( $type == FIELD_U32 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2720 | 0 | push @vals, $df->_read_u32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2722 | elsif( $type == FIELD_UINT ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2723 | 0 | push @vals, $df->_read_uint; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2725 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2726 | 0 | croak "TODO: load struct field type = $type\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2730 | 0 | $self->_set_struct_fields( @vals ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2733 | =head2 fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2735 | @kvlist = $struct->fields; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2737 | Returns an even-sized name/value list of all the field values stored by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2738 | struct; each preceeded by its field type structure. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2740 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2742 | 0 | ▶ | sub fields ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fields: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2743 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2744 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2746 | 0 | my $fields = $self->structtype->fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2748 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2749 | 0 | my $field = $fields->[$_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2751 | 0 | ▶ | if( $field->type == FIELD_PTR ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2752 | 0 | $field => $df->sv_at( $self->field( $_ ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2754 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2755 | 0 | $field => $self->field( $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2757 | } 0 .. $#$fields; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2760 | =head2 field_named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2762 | $val = $struct->field_named( $name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2764 | Looks for a field whose name is exactly that given, and returns its value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2766 | Throws an exception if the struct has no such field of that name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2768 | =head2 maybe_field_named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2770 | $val = $struct->maybe_field_named( $name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2772 | I<Since version 0.49.> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2774 | As L</field_named> but returns C<undef> if there is no such field. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2776 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2778 | 0 | ▶ | sub maybe_field_named ( $self, $name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maybe_field_named: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2779 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2780 | 0 | my $fields = $self->structtype->fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2781 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2782 | 0 | ▶ | defined( my $idx = first { $fields->[$_]->name eq $name } 0 .. $#$fields ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2783 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2785 | 0 | my $field = $fields->[$idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2787 | 0 | ▶ | if( $field->type == FIELD_PTR ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2788 | 0 | return $self->df->sv_at( $self->field( $idx ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2789 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2790 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2791 | 0 | return $self->field( $idx ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2795 | 0 | ▶ | sub field_named ( $self, $name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
field_named: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2796 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2797 | 0 | ▶ | return $self->maybe_field_named( $name ) // croak "No field named $name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->maybe_field_named($name) // croak("No field named $name")
MC/DC0%0/1
$self->maybe_field_named($name) // croak("No field named $name")
$self->maybe_field_named($name)
Truth table0%0/2
A
A= $self->maybe_field_named($name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2800 | =head2 structtype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2802 | $structtype = $struct->structtype; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2804 | Returns a metadata structure describing the type of the struct itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2806 | Has the following named accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2808 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2810 | =item name => STRING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2812 | The name of the struct type, as given by the dumpfile. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2814 | =item fields => ARRAY[ Field ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2816 | An ARRAY reference containing the definitions of each field in turn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2818 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2820 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2822 | 0 | ▶ | sub structtype ( $self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
structtype: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2823 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2824 | 0 | return $self->df->structtype( $self->structid ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2827 | 0 | ▶ | sub _outrefs ( $self, $match, $no_desc ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_outrefs: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2828 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2829 | 0 | ▶ | return unless $match & STRENGTH_STRONG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2831 | 0 | my $df = $self->df; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2833 | 0 | my @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2835 | 0 | my $fields = $self->structtype->fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2836 | 0 | foreach my $idx ( 0 .. $#$fields ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2837 | 0 | my $field = $fields->[$idx]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2838 | 0 | ▶ | $field->type == FIELD_PTR or next; # Is PTR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2840 | 0 | ▶ | my $sv = $df->sv_at( $self->field( $idx ) ) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2842 | 0 | ▶ | push @outrefs, $no_desc ? ( strong => $sv ) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2843 | Devel::MAT::SV::Reference( $field->name, strong => $sv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2844 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2846 | 0 | return @outrefs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2847 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2849 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2851 | Paul Evans <leonerd@leonerd.org.uk> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2853 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2855 | 10 | 0x55AA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||