| 1 | 2 | ▶ | use 5.008003; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict qw( subs vars ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | no warnings qw( once uninitialized ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | package Marmoset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.000_01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | our (%ATTRIBUTES, %IS_FINAL, %OFFSETS, %SIZES); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | sub _class_for_objects { 'Marmoset::Object' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_class_for_objects: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | sub _class_for_fields { 'Marmoset::Attribute::Field' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_class_for_fields: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | sub _class_for_attributes { 'Marmoset::Attribute::InsideOut' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_class_for_attributes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use B qw(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use Eval::TypeTiny qw(eval_closure); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use Exporter::Shiny our(@EXPORT) = qw( has extends ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Sub::Accessor::Small 0.008 (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | ($] >= 5.010) ? do { require mro } : do { require MRO::Compat }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sub _exporter_validate_opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exporter_validate_opts: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | my ($globals) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | my $caller = $globals->{into}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | ▶ | ref($caller) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | and croak("Cannot import Marmoset into a reference; bailing out"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | @{"$caller\::ISA"} = $me->_class_for_objects; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | sub _generate_has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generate_has: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | my ($name, undef, $globals) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | my $caller = $globals->{into}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 6 | ▶ | $IS_FINAL{$caller} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | and croak("$caller has already been instantiated; cannot add attributes; bailing out"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 5 | my ($name, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | my $attr_class = exists($opts{pack}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 5 | ▶ | ? $me->_class_for_fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | : $me->_class_for_attributes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 5 | $attr_class->has($globals, $name, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | sub _generate_extends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generate_extends: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | my ($name, undef, $globals) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | my $caller = $globals->{into}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 4 | my $need = $me->_class_for_objects; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | return sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | ▶ | $IS_FINAL{$caller} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | and croak("$caller has already been instantiated; cannot change inheritance; bailing out"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | my @parents = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $_->isa($need) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | or croak("Cannot inherit from $need; it is not a $me class (does not inherit from $need); bailing out") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | ▶ | for @parents; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | @{"$caller\::ISA"} = @parents; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | sub make_immutable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_immutable: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 9 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 9 | $IS_FINAL{$_} = 1 for @{mro::get_linear_isa($class)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 9 | $me->_initialize_slots($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 9 | return $me->_build_constructor($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | sub _initialize_slots | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize_slots: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 9 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 9 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | my @fields = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | grep exists($_->{pack}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 22 | ▶ | map @{ $ATTRIBUTES{$_} or [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Marmoset::ATTRIBUTES{$_} || []
MC/DC100%1/1
$Marmoset::ATTRIBUTES{$_} || []
$Marmoset::ATTRIBUTES{$_}
Truth table100%2/2
A
A= $Marmoset::ATTRIBUTES{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 9 | @{mro::get_linear_isa($class)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 9 | my ($n, @sizes, @offsets) = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | $sizes[@sizes] = $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | $offsets[@offsets] = $n, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | $n += $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 9 | for map length(pack $_->{pack}, 0), @fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 9 | for my $i (0 .. $#fields) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 14 | local $Marmoset::REALLY_INSTALL = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 14 | my $f = $fields[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 14 | (my($tmp), $f->{package}) = ($f->{package}, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 14 | ($f->{OFFSET}, $f->{SIZE}) = ($offsets[$i], $sizes[$i]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 14 | $f->install_accessors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 14 | delete($f->{$_}) for qw( OFFSET SIZE ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 14 | $f->{package} = $tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | sub _build_constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_constructor: called CC=29 SCAR=38.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 9 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 9 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 9 | my @isa = @{mro::get_linear_isa($class)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 9 | ▶ | my @attr = map @{ $ATTRIBUTES{$_} or [] }, @isa; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Marmoset::ATTRIBUTES{$_} || []
MC/DC100%1/1
$Marmoset::ATTRIBUTES{$_} || []
$Marmoset::ATTRIBUTES{$_}
Truth table100%2/2
A
A= $Marmoset::ATTRIBUTES{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 9 | my @fields = grep exists($_->{pack}), @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 9 | my $template = B::perlstring( join q[ ], map $_->{pack}, @fields ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 9 | my @others = grep !exists($_->{pack}), @attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | my @build_methods = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | map "$_\::BUILD", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 9 | grep exists(&{"$_\::BUILD"}), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | @isa; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | my %defaults = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 9 | ▶ | exists($_->{default}) ? ($_->{slot}, $_->{default}) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } @attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | my %triggers = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 9 | ▶ | exists($_->{trigger}) ? ($_->{slot}, $_->{trigger}) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } @attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | my %types = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 9 | ▶ | exists($_->{isa}) ? ($_->{slot}, $_->{isa}) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } @attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 9 | my @code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 9 | push @code, 'sub {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 9 | push @code, ' my $class = shift;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 9 | push @code, ' if ($class ne '.B::perlstring($class).') {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 9 | push @code, ' my $new = "Marmoset"->make_immutable($class);'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 9 | push @code, ' goto $new;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 9 | push @code, ' }'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 9 | push @code, ' my $str = "";'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 9 | push @code, ' my $self = \$str;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 9 | push @code, ' bless $self, $class;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 9 | push @code, ' my $params = $class->BUILDARGS(@_);'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 9 | push @code, ' my (@f, $tmp);'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 9 | for my $f (@fields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 14 | push @code, ' if (exists($params->{'.B::perlstring($f->{init_arg}).'})) {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 14 | push @code, ' $$tmp = $params->{'.B::perlstring($f->{init_arg}).'};'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | push @code, ' $triggers{'.B::perlstring($f->{slot}).'}->($self, $params->{'.B::perlstring($f->{init_arg}).'});' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 14 | ▶ | if $triggers{$f->{slot}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 14 | push @code, ' }'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 14 | push @code, ' else {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 14 | ▶ | if ($f->{default} and not $f->{lazy}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$f->{"default"} and not $f->{"lazy"}
MC/DC50%1/2
$f->{"default"} and not $f->{"lazy"}
$f->{"default"}
not $f->{"lazy"}
Truth table66%2/3
A and not(B)
A= $f->{"default"}B= not $f->{"lazy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 11 | push @code, ' $$tmp = scalar($defaults{'.B::perlstring($f->{slot}).'}->($self));'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ▶ | elsif ($f->{builder} and not $f->{lazy}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$f->{"builder"} and not $f->{"lazy"}
MC/DC0%0/2
$f->{"builder"} and not $f->{"lazy"}
$f->{"builder"}
not $f->{"lazy"}
Truth table33%1/3
A and not(B)
A= $f->{"builder"}B= not $f->{"lazy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | push @code, ' $$tmp = scalar($self->'.$f->{builder}.'());'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 3 | push @code, ' Carp::croak(sprintf "Required parameter \\"%s\\" not supplied to constructor; stopped", '.B::perlstring($f->{init_arg}).');'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 14 | push @code, ' }'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 14 | ▶ | if (my $type = $f->{isa}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 3 | ▶ | if ($f->{coerce}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | push @code, ' $$tmp = '.( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | $type->coercion->can_be_inlined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ? $type->coercion->inline_coercion('${$tmp}') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 3 | ▶ | : '$types{'.B::perlstring($f->{slot}).'}->coerce($$tmp)' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | ).';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | push @code, ' '.( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | $type->can_be_inlined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ? $type->inline_assert('${$tmp}') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 3 | ▶ | : ('$types{'.B::perlstring($f->{slot}).'}->assert_value($$tmp)') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ).';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 14 | push @code, ' push @f, $$tmp;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 14 | push @code, ' undef $tmp;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 9 | push @code, ' $str = pack('.$template.', @f);'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 9 | ▶ | push @code, ' @_ = $self;' if @others; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 9 | for my $f (@others) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 3 | push @code, ' if (exists($params->{'.B::perlstring($f->{init_arg}).'})) {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 3 | push @code, ' $$tmp = $params->{'.B::perlstring($f->{init_arg}).'};'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | push @code, ' $triggers{'.B::perlstring($f->{slot}).'}->($self, $params->{'.B::perlstring($f->{init_arg}).'});' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 3 | ▶ | if $triggers{$f->{slot}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 3 | push @code, ' }'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 3 | push @code, ' else {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | ▶ | if ($f->{default} and not $f->{lazy}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$f->{"default"} and not $f->{"lazy"}
MC/DC0%0/2
$f->{"default"} and not $f->{"lazy"}
$f->{"default"}
not $f->{"lazy"}
Truth table33%1/3
A and not(B)
A= $f->{"default"}B= not $f->{"lazy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | push @code, ' $$tmp = scalar($defaults{'.B::perlstring($f->{slot}).'}->($self));'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ▶ | elsif ($f->{builder} and not $f->{lazy}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$f->{"builder"} and not $f->{"lazy"}
MC/DC0%0/2
$f->{"builder"} and not $f->{"lazy"}
$f->{"builder"}
not $f->{"lazy"}
Truth table33%1/3
A and not(B)
A= $f->{"builder"}B= not $f->{"lazy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | push @code, ' $$tmp = scalar($self->'.$f->{builder}.'());'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | elsif ($f->{required}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | push @code, ' Carp::croak(sprintf "Required parameter \\"%s\\" not supplied to constructor; stopped", '.B::perlstring($f->{init_arg}).');'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 3 | push @code, ' ();'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 3 | push @code, ' }'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 3 | ▶ | if (my $type = $f->{isa}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | push @code, ' if ($tmp) {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | if ($f->{coerce}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | push @code, ' $$tmp = '.( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | $type->coercion->can_be_inlined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | ? $type->coercion->inline_coercion('${$tmp}') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | : '$types{'.B::perlstring($f->{slot}).'}->coerce($$tmp)' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | ).';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | push @code, ' '.( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | $type->can_be_inlined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ? $type->inline_assert('${$tmp}') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | : ('$types{'.B::perlstring($f->{slot}).'}->assert_value($$tmp)') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ).';'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | push @code, ' }'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | push @code, ' '.$f->inline_access.' = $$tmp if $tmp;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | push @code, ' undef $tmp;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 9 | push @code, " \$self->$_\(\$params);" for reverse @build_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 9 | push @code, ' $self;'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 9 | push @code, '}'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 9 | my $coderef = eval_closure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | source => join("\n", @code), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | environment => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | '%defaults' => \%defaults, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | '%triggers' => \%triggers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | '%types' => \%types, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | *{"$class\::new"} = Marmoset::Attribute->HAS_SUB_NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | ? Sub::Name::subname("$class\::new", $coderef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | : $coderef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | return $coderef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | package Marmoset::Object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 2 | our $VERSION = '0.000_01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 9 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 9 | my $new = 'Marmoset'->make_immutable($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | goto $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | sub BUILDARGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | +{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | (@_==1 and ref($_[0]) eq q(HASH)) ? %{$_[0]} : @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | sub DESTROY { return; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | package Marmoset::Attribute; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 2 | our $VERSION = '0.000_01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | our @ISA = qw(Sub::Accessor::Small); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub accessor_kind { 'Marmoset' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accessor_kind: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | sub canonicalize_opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonicalize_opts: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 5 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 5 | $me->SUPER::canonicalize_opts(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 5 | ▶ | $me->{init_arg} = $me->{slot} unless exists $me->{init_arg}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # Save options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 5 | ▶ | push @{ $ATTRIBUTES{$me->{package}} ||= [] }, $me; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Marmoset::ATTRIBUTES{$me->{"package"}} ||= []
MC/DC100%1/1
$Marmoset::ATTRIBUTES{$me->{"package"}} ||= []
$Marmoset::ATTRIBUTES{$me->{"package"}}
Truth table100%2/2
A
A= $Marmoset::ATTRIBUTES{$me->{"package"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 2 | package Marmoset::Attribute::Field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 2 | our $VERSION = '0.000_01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 2 | our @ISA = qw(Marmoset::Attribute); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 14 | ▶ | sub accessor_kind { 'Marmoset packed' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accessor_kind: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | sub canonicalize_opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonicalize_opts: called CC=6 SCAR=21.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 4 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 4 | $me->SUPER::canonicalize_opts(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | croak "Attribute '$me->{slot}' is a field, therefore must be required or have a default; bailing out" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | if exists($me->{required}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | && !$me->{required} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | && !$me->{builder} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 4 | ▶ | && !$me->{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
exists $me->{"required"} and not $me->{"required"} and not $me->{"builder"} and not $me->{"default"}
exists $me->{"required"} and not $me->{"required"} and not $me->{"builder"}
exists $me->{"required"} and not $me->{"required"}
MC/DC0%0/4
exists $me->{"required"} and not $me->{"required"} and not $me->{"builder"} and not $me->{"default"}
exists $me->{"required"}
not $me->{"required"}
not $me->{"builder"}
not $me->{"default"}
Truth table40%2/5
A and not(B) and not(C) and not(D)
A= exists $me->{"required"}B= not $me->{"required"}C= not $me->{"builder"}D= not $me->{"default"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | croak "Attribute '$me->{slot}' is a field, therefore cannot be cleared; bailing out" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 4 | ▶ | if defined($me->{clearer}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | sub inline_clearer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inline_clearer: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | croak "This class cannot generate a clearer; bailing out"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | sub inline_predicate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inline_predicate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | return q[ 1 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | sub inline_access | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 24 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inline_access: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 24 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 'unpack(q(%s), substr(${$_[0]}, %d, %d))', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | $me->{pack}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | $me->{OFFSET} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 24 | ▶ | $me->{SIZE} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$me->{'OFFSET'} || 0
$me->{'SIZE'} || 0
MC/DC100%1/1
$me->{'OFFSET'} || 0
$me->{'OFFSET'}
MC/DC0%0/1
$me->{'SIZE'} || 0
$me->{'SIZE'}
Truth table100%2/2
A
A= $me->{'OFFSET'}
Truth table50%1/2
A
A= $me->{'SIZE'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | sub inline_access_w | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inline_access_w: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 7 | my $me = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 7 | my ($expr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 'substr(${$_[0]}, %d, %d) = pack(q(%s), %s)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | $me->{OFFSET} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | $me->{SIZE} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | $me->{pack}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 7 | ▶ | $expr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$me->{'OFFSET'} || 0
$me->{'SIZE'} || 0
MC/DC100%1/1
$me->{'OFFSET'} || 0
$me->{'OFFSET'}
MC/DC0%0/1
$me->{'SIZE'} || 0
$me->{'SIZE'}
Truth table100%2/2
A
A= $me->{'OFFSET'}
Truth table50%1/2
A
A= $me->{'SIZE'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | sub install_accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 18 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_accessors: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 18 | ▶ | return unless $Marmoset::REALLY_INSTALL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 14 | shift->SUPER::install_accessors(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 2 | package Marmoset::Attribute::InsideOut; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 2 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 2 | our $VERSION = '0.000_01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 2 | our @ISA = qw(Marmoset::Attribute); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 2 | ▶ | sub accessor_kind { 'Marmoset inside-out' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accessor_kind: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||