no warnings 'uninitialized';
my $name = $self->name;
return unless $name =~ /^$ANON_CLASS_PREFIX/o;
+
# Moose does a weird thing where it replaces the metaclass for
# class when fixing metaclass incompatibility. In that case,
# we don't want to clean out the namespace now. We can detect
# this intentionally does nothing, it is just a hook
}
+sub get_all_attributes {
+ my $self = shift;
+ my %attrs = map { %{ $self->initialize($_)->_attribute_map } }
+ reverse $self->linearized_isa;
+ return values %attrs;
+}
+
# Inheritance
sub superclasses {
$self->remove_attribute($attr_name);
}
else {
- $self->invalidate_meta_instances();
+ $self->invalidate_meta_instances()
+ if $self->can('invalidate_meta_instances');
}
# get our count of previously inserted attributes and
return unless defined $removed_attribute;
delete $self->_attribute_map->{$attribute_name};
- $self->invalidate_meta_instances();
+ $self->invalidate_meta_instances()
+ if $self->can('invalidate_meta_instances');
$removed_attribute->remove_accessors();
$removed_attribute->detach_from_class();
keys %{ $self->_attribute_map };
}
-sub get_all_attributes {
- my $self = shift;
- my %attrs = map { %{ $self->initialize($_)->_attribute_map } }
- reverse $self->linearized_isa;
- return values %attrs;
-}
-
sub find_attribute_by_name {
my ( $self, $attr_name ) = @_;