return $meta;
}
- # NOTE:
- # we need to deal with the possibility
- # of class immutability here, and then
- # get the name of the class appropriately
- $class = (ref($class)
- ? ($class->is_immutable
- ? $class->_get_mutable_metaclass_name()
- : ref($class))
- : $class);
+ $class
+ = ref $class
+ ? $class->_real_ref_name
+ : $class;
# now create the metaclass
my $meta;
$meta;
}
+sub _real_ref_name {
+ my $self = shift;
+
+ # NOTE: we need to deal with the possibility of class immutability here,
+ # and then get the name of the class appropriately
+ return $self->is_immutable
+ ? $self->_get_mutable_metaclass_name()
+ : ref $self;
+}
+
sub _new {
my $class = shift;
my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name)
|| return 1;
- # NOTE:
- # we need to deal with the possibility
- # of class immutability here, and then
- # get the name of the class appropriately
- my $super_meta_type
- = $super_meta->is_immutable
- ? $super_meta->_get_mutable_metaclass_name()
- : ref($super_meta);
+ my $super_meta_type = $super_meta->_real_ref_name;
return $self->isa($super_meta_type);
}
if (!$self->_class_metaclass_is_compatible($superclass_name)) {
my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name);
- # NOTE:
- # we need to deal with the possibility
- # of class immutability here, and then
- # get the name of the class appropriately
- my $super_meta_type
- = $super_meta->is_immutable
- ? $super_meta->_get_mutable_metaclass_name()
- : ref($super_meta);
+ my $super_meta_type = $super_meta->_real_ref_name;
confess "The metaclass of " . $self->name . " ("
. (ref($self)) . ")" . " is not compatible with "
my $self = shift;
my ($super_meta) = @_;
- # NOTE:
- # we need to deal with the possibility
- # of class immutability here, and then
- # get the name of the class appropriately
- my $super_meta_type
- = $super_meta->is_immutable
- ? $super_meta->_get_mutable_metaclass_name()
- : ref($super_meta);
+ my $super_meta_type = $super_meta->_real_ref_name;
return $super_meta_type ne blessed($self)
&& $super_meta->isa(blessed($self));
is_mutable is_immutable make_mutable make_immutable
_initialize_immutable _install_inlined_code _inlined_methods
_add_inlined_method _inline_accessors _inline_constructor
- _inline_destructor _immutable_options _rebless_as_immutable
- _rebless_as_mutable _remove_inlined_code
+ _inline_destructor _immutable_options _real_ref_name
+ _rebless_as_immutable _rebless_as_mutable _remove_inlined_code
_immutable_metaclass
immutable_trait immutable_options