« blib/lib/Moose/Meta/Role/Composite.pm
↑ Summary
blib/lib/Moose/Meta/TypeConstraint/Parameterized.pm »
| 1 | package Class::MOP::Instance; | ||||||||||||||||||||||||||||||||||
| 2 | 460 | our $VERSION = '2.4001'; | |||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||
| 4 | 460 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | 460 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||
| 7 | 460 | ▶ | use Scalar::Util 'isweak', 'weaken', 'blessed'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | 460 | ▶ | use parent 'Class::MOP::Object'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | # make this not a valid method name, to avoid (most) attribute conflicts | ||||||||||||||||||||||||||||||||||
| 12 | 460 | my $RESERVED_MOP_SLOT = '<<MOP>>'; | |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||
| 14 | 21553 | ▶ | sub BUILDARGS { | ||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: called CC=7 SCAR=23.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 15 | 21553 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | 21553 | ▶ | if ( @args == 1 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 18 | 0 | unshift @args, "associated_metaclass"; | |||||||||||||||||||||||||||||||||
| 19 | ▶ | } elsif ( @args >= 2 && blessed($args[0]) && $args[0]->isa("Class::MOP::Class") ) { | |||||||||||||||||||||||||||||||||
|
Condition33%2/6
@args >= 2 and builtin::blessed($args[0]) and $args[0]->isa("Class::MOP::Class")
@args >= 2 and builtin::blessed($args[0])
MC/DC0%0/3
@args >= 2 and builtin::blessed($args[0]) and $args[0]->isa("Class::MOP::Class")
@args >= 2
builtin::blessed($args[0])
$args[0]->isa("Class::MOP::Class")
Truth table25%1/4
A and B and C
A= @args >= 2B= builtin::blessed($args[0])C= $args[0]->isa("Class::MOP::Class")
| |||||||||||||||||||||||||||||||||||
| 20 | # compat mode | ||||||||||||||||||||||||||||||||||
| 21 | 0 | my ( $meta, @attrs ) = @args; | |||||||||||||||||||||||||||||||||
| 22 | 0 | @args = ( associated_metaclass => $meta, attributes => \@attrs ); | |||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | 21553 | my %options = @args; | |||||||||||||||||||||||||||||||||
| 26 | # FIXME lazy_build | ||||||||||||||||||||||||||||||||||
| 27 | 21553 | ▶ | $options{slots} ||= [ map { $_->slots } @{ $options{attributes} || [] } ]; | ||||||||||||||||||||||||||||||||
|
Condition50%2/4
$options{"slots"} ||= [map({$_->slots;} @{$options{"attributes"} or [];})]
$options{'attributes'} || []
MC/DC0%0/1
$options{"slots"} ||= [map({$_->slots;} @{$options{"attributes"} or [];})]
$options{"slots"}
MC/DC0%0/1
$options{'attributes'} || []
$options{'attributes'}
Truth table50%1/2
A
A= $options{"slots"}
Truth table50%1/2
A
A= $options{'attributes'}
| |||||||||||||||||||||||||||||||||||
| 28 | 21553 | $options{slot_hash} = { map { $_ => undef } @{ $options{slots} } }; # FIXME lazy_build | |||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||
| 30 | 21553 | return \%options; | |||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||
| 33 | 21553 | ▶ | sub new { | ||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 34 | 21553 | my $class = shift; | |||||||||||||||||||||||||||||||||
| 35 | 21553 | my $options = $class->BUILDARGS(@_); | |||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | # FIXME replace with a proper constructor | ||||||||||||||||||||||||||||||||||
| 38 | 21553 | my $instance = $class->_new(%$options); | |||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||
| 40 | # FIXME weak_ref => 1, | ||||||||||||||||||||||||||||||||||
| 41 | 21553 | weaken($instance->{'associated_metaclass'}); | |||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||
| 43 | 21553 | return $instance; | |||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||
| 46 | 18952 | ▶ | sub _new { | ||||||||||||||||||||||||||||||||
|
Subroutine
_new: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||
| 47 | 18952 | my $class = shift; | |||||||||||||||||||||||||||||||||
| 48 | 18952 | ▶ | return Class::MOP::Class->initialize($class)->new_object(@_) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 49 | if $class ne __PACKAGE__; | ||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | 18941 | ▶ | my $params = @_ == 1 ? $_[0] : {@_}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 52 | return bless { | ||||||||||||||||||||||||||||||||||
| 53 | # NOTE: | ||||||||||||||||||||||||||||||||||
| 54 | # I am not sure that it makes | ||||||||||||||||||||||||||||||||||
| 55 | # sense to pass in the meta | ||||||||||||||||||||||||||||||||||
| 56 | # The ideal would be to just | ||||||||||||||||||||||||||||||||||
| 57 | # pass in the class name, but | ||||||||||||||||||||||||||||||||||
| 58 | # that is placing too much of | ||||||||||||||||||||||||||||||||||
| 59 | # an assumption on bless(), | ||||||||||||||||||||||||||||||||||
| 60 | # which is *probably* a safe | ||||||||||||||||||||||||||||||||||
| 61 | # assumption,.. but you can | ||||||||||||||||||||||||||||||||||
| 62 | # never tell <:) | ||||||||||||||||||||||||||||||||||
| 63 | 'associated_metaclass' => $params->{associated_metaclass}, | ||||||||||||||||||||||||||||||||||
| 64 | 'attributes' => $params->{attributes}, | ||||||||||||||||||||||||||||||||||
| 65 | 'slots' => $params->{slots}, | ||||||||||||||||||||||||||||||||||
| 66 | 'slot_hash' => $params->{slot_hash}, | ||||||||||||||||||||||||||||||||||
| 67 | 18941 | } => $class; | |||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | 23867 | ▶ | sub _class_name { $_[0]->{_class_name} ||= $_[0]->associated_metaclass->name } | ||||||||||||||||||||||||||||||||
|
Subroutine
_class_name: called CC=2 SCAR=7.2
Condition66%2/3
$_[0]{"_class_name"} ||= $_[0]->associated_metaclass->name
MC/DC0%0/2
$_[0]{"_class_name"} ||= $_[0]->associated_metaclass->name
$_[0]{"_class_name"}
$_[0]->associated_metaclass->name
Truth table66%2/3
A ||= B
A= $_[0]{"_class_name"}B= $_[0]->associated_metaclass->name
| |||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||
| 72 | 23856 | ▶ | sub create_instance { | ||||||||||||||||||||||||||||||||
|
Subroutine
create_instance: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 73 | 23856 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 74 | 23856 | bless {}, $self->_class_name; | |||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||
| 77 | 17 | ▶ | sub clone_instance { | ||||||||||||||||||||||||||||||||
|
Subroutine
clone_instance: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 78 | 17 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | 17 | my $clone = $self->create_instance; | |||||||||||||||||||||||||||||||||
| 81 | 17 | for my $attr ($self->get_all_attributes) { | |||||||||||||||||||||||||||||||||
| 82 | 172 | ▶ | next unless $attr->has_value($instance); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 83 | 162 | for my $slot ($attr->slots) { | |||||||||||||||||||||||||||||||||
| 84 | 163 | my $val = $self->get_slot_value($instance, $slot); | |||||||||||||||||||||||||||||||||
| 85 | 163 | $self->set_slot_value($clone, $slot, $val); | |||||||||||||||||||||||||||||||||
| 86 | 163 | ▶ | $self->weaken_slot_value($clone, $slot) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 87 | if $self->slot_value_is_weak($instance, $slot); | ||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||
| 91 | 17 | ▶ | $self->_set_mop_slot($clone, $self->_get_mop_slot($instance)) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 92 | if $self->_has_mop_slot($instance); | ||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||
| 94 | 17 | return $clone; | |||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||
| 97 | # operations on meta instance | ||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||
| 99 | 11 | ▶ | sub get_all_slots { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_all_slots: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 100 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 101 | 11 | return @{$self->{'slots'}}; | |||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||
| 104 | 17 | ▶ | sub get_all_attributes { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_all_attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 105 | 17 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 106 | 17 | return @{$self->{attributes}}; | |||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub is_valid_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_valid_slot: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 110 | 0 | my ($self, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 111 | 0 | exists $self->{'slot_hash'}->{$slot_name}; | |||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||
| 114 | # operations on created instances | ||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||
| 116 | 6754 | ▶ | sub get_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 117 | 6754 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 118 | 6754 | $instance->{$slot_name}; | |||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||
| 121 | 136509 | ▶ | sub set_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
set_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 122 | 136509 | my ($self, $instance, $slot_name, $value) = @_; | |||||||||||||||||||||||||||||||||
| 123 | 136509 | $instance->{$slot_name} = $value; | |||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||
| 126 | 1 | ▶ | sub initialize_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
initialize_slot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 127 | 1 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 128 | 1 | return; | |||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||
| 131 | 19 | ▶ | sub deinitialize_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
deinitialize_slot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 132 | 19 | my ( $self, $instance, $slot_name ) = @_; | |||||||||||||||||||||||||||||||||
| 133 | 19 | delete $instance->{$slot_name}; | |||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||
| 136 | 5 | ▶ | sub initialize_all_slots { | ||||||||||||||||||||||||||||||||
|
Subroutine
initialize_all_slots: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 137 | 5 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 138 | 5 | foreach my $slot_name ($self->get_all_slots) { | |||||||||||||||||||||||||||||||||
| 139 | 16 | $self->initialize_slot($instance, $slot_name); | |||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub deinitialize_all_slots { | ||||||||||||||||||||||||||||||||
|
Subroutine
deinitialize_all_slots: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 144 | 0 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 145 | 0 | foreach my $slot_name ($self->get_all_slots) { | |||||||||||||||||||||||||||||||||
| 146 | 0 | $self->deinitialize_slot($instance, $slot_name); | |||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||
| 150 | 7467 | ▶ | sub is_slot_initialized { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_slot_initialized: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 151 | 7467 | my ($self, $instance, $slot_name, $value) = @_; | |||||||||||||||||||||||||||||||||
| 152 | 7467 | exists $instance->{$slot_name}; | |||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||
| 155 | 54 | ▶ | sub weaken_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
weaken_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 156 | 54 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 157 | 54 | weaken $instance->{$slot_name}; | |||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||
| 160 | 165 | ▶ | sub slot_value_is_weak { | ||||||||||||||||||||||||||||||||
|
Subroutine
slot_value_is_weak: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 161 | 165 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 162 | 165 | isweak $instance->{$slot_name}; | |||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | sub strengthen_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
strengthen_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 166 | 1 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 167 | 1 | $self->set_slot_value($instance, $slot_name, $self->get_slot_value($instance, $slot_name)); | |||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||
| 170 | 126 | ▶ | sub rebless_instance_structure { | ||||||||||||||||||||||||||||||||
|
Subroutine
rebless_instance_structure: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 171 | 126 | my ($self, $instance, $metaclass) = @_; | |||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||
| 173 | # we use $_[1] here because of t/cmop/rebless_overload.t regressions | ||||||||||||||||||||||||||||||||||
| 174 | # on 5.8.8 | ||||||||||||||||||||||||||||||||||
| 175 | 126 | bless $_[1], $metaclass->name; | |||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||
| 178 | 21549 | ▶ | sub is_dependent_on_superclasses { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_dependent_on_superclasses: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 179 | 21549 | return; # for meta instances that require updates on inherited slot changes | |||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | sub _get_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_get_mop_slot: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 183 | 1 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 184 | 1 | $self->get_slot_value($instance, $RESERVED_MOP_SLOT); | |||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||
| 187 | 17 | ▶ | sub _has_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_has_mop_slot: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 188 | 17 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 189 | 17 | $self->is_slot_initialized($instance, $RESERVED_MOP_SLOT); | |||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||
| 192 | 1688 | ▶ | sub _set_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_set_mop_slot: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 193 | 1688 | my ($self, $instance, $value) = @_; | |||||||||||||||||||||||||||||||||
| 194 | 1688 | $self->set_slot_value($instance, $RESERVED_MOP_SLOT, $value); | |||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||
| 197 | 1 | ▶ | sub _clear_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_clear_mop_slot: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 198 | 1 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 199 | 1 | $self->deinitialize_slot($instance, $RESERVED_MOP_SLOT); | |||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||
| 202 | # inlinable operation snippets | ||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||
| 204 | 42793 | ▶ | sub is_inlinable { 1 } | ||||||||||||||||||||||||||||||||
|
Subroutine
is_inlinable: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||
| 206 | 12482 | ▶ | sub inline_create_instance { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_create_instance: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 207 | 12482 | my ($self, $class_variable) = @_; | |||||||||||||||||||||||||||||||||
| 208 | 12482 | 'bless {} => ' . $class_variable; | |||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||
| 211 | 199286 | ▶ | sub inline_slot_access { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_slot_access: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 212 | 199286 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 213 | 199286 | sprintf q[%s->{"%s"}], $instance, quotemeta($slot_name); | |||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||
| 216 | 331 | ▶ | sub inline_get_is_lvalue { 1 } | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_get_is_lvalue: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||
| 218 | 33581 | ▶ | sub inline_get_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_get_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 219 | 33581 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 220 | 33581 | $self->inline_slot_access($instance, $slot_name); | |||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||
| 223 | 157650 | ▶ | sub inline_set_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_set_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 224 | 157650 | my ($self, $instance, $slot_name, $value) = @_; | |||||||||||||||||||||||||||||||||
| 225 | 157650 | $self->inline_slot_access($instance, $slot_name) . " = $value", | |||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||
| 228 | 1 | ▶ | sub inline_initialize_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_initialize_slot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 229 | 1 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 230 | 1 | return ''; | |||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||
| 233 | 79 | ▶ | sub inline_deinitialize_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_deinitialize_slot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 234 | 79 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 235 | 79 | "delete " . $self->inline_slot_access($instance, $slot_name); | |||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||
| 237 | 7208 | ▶ | sub inline_is_slot_initialized { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_is_slot_initialized: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 238 | 7208 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 239 | 7208 | "exists " . $self->inline_slot_access($instance, $slot_name); | |||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||
| 242 | 778 | ▶ | sub inline_weaken_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_weaken_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 243 | 778 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 244 | 778 | sprintf "Scalar::Util::weaken( %s )", $self->inline_slot_access($instance, $slot_name); | |||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||
| 247 | 1 | ▶ | sub inline_strengthen_slot_value { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_strengthen_slot_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 248 | 1 | my ($self, $instance, $slot_name) = @_; | |||||||||||||||||||||||||||||||||
| 249 | 1 | $self->inline_set_slot_value($instance, $slot_name, $self->inline_slot_access($instance, $slot_name)); | |||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||
| 252 | 1 | ▶ | sub inline_rebless_instance_structure { | ||||||||||||||||||||||||||||||||
|
Subroutine
inline_rebless_instance_structure: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 253 | 1 | my ($self, $instance, $class_variable) = @_; | |||||||||||||||||||||||||||||||||
| 254 | 1 | "bless $instance => $class_variable"; | |||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub _inline_get_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_inline_get_mop_slot: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 258 | 0 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 259 | 0 | $self->inline_get_slot_value($instance, $RESERVED_MOP_SLOT); | |||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||
| 262 | 21 | ▶ | sub _inline_set_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_inline_set_mop_slot: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 263 | 21 | my ($self, $instance, $value) = @_; | |||||||||||||||||||||||||||||||||
| 264 | 21 | $self->inline_set_slot_value($instance, $RESERVED_MOP_SLOT, $value); | |||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | sub _inline_clear_mop_slot { | ||||||||||||||||||||||||||||||||
|
Subroutine
_inline_clear_mop_slot: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 268 | 0 | my ($self, $instance) = @_; | |||||||||||||||||||||||||||||||||
| 269 | 0 | $self->inline_deinitialize_slot($instance, $RESERVED_MOP_SLOT); | |||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||
| 272 | 460 | 1; | |||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||
| 274 | # ABSTRACT: Instance Meta Object | ||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||
| 276 | __END__ | ||||||||||||||||||||||||||||||||||