use Scalar::Util 'weaken', 'blessed';
-our $VERSION = '1.09';
+our $VERSION = '1.11';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use base 'Class::MOP::Object';
+# make this not a valid method name, to avoid (most) attribute conflicts
+my $RESERVED_MOP_SLOT = '<<MOP>>';
+
sub BUILDARGS {
my ($class, @args) = @_;
sub _class_name { $_[0]->{_class_name} ||= $_[0]->associated_metaclass->name }
-sub associated_metaclass { $_[0]{'associated_metaclass'} }
-
sub create_instance {
my $self = shift;
bless {}, $self->_class_name;
return; # for meta instances that require updates on inherited slot changes
}
+sub _get_mop_slot {
+ my ($self, $instance) = @_;
+ $self->get_slot_value($instance, $RESERVED_MOP_SLOT);
+}
+
+sub _set_mop_slot {
+ my ($self, $instance, $value) = @_;
+ $self->set_slot_value($instance, $RESERVED_MOP_SLOT, $value);
+}
+
+sub _clear_mop_slot {
+ my ($self, $instance) = @_;
+ $self->deinitialize_slot($instance, $RESERVED_MOP_SLOT);
+}
+
# inlinable operation snippets
sub is_inlinable { 1 }
"bless $instance => $class_variable";
}
+sub _inline_get_mop_slot {
+ my ($self, $instance) = @_;
+ $self->inline_get_slot_value($instance, $RESERVED_MOP_SLOT);
+}
+
+sub _inline_set_mop_slot {
+ my ($self, $instance, $value) = @_;
+ $self->inline_set_slot_value($instance, $RESERVED_MOP_SLOT, $value);
+}
+
+sub _inline_clear_mop_slot {
+ my ($self, $instance) = @_;
+ $self->inline_deinitialize_slot($instance, $RESERVED_MOP_SLOT);
+}
+
1;
__END__