Merge branch 'master' into topic/symbol-manipulator
[gitmo/Class-MOP.git] / lib / Class / MOP / Class / Immutable / Trait.pm
index 0c8a505..29c79e8 100644 (file)
@@ -8,7 +8,7 @@ use MRO::Compat;
 use Carp 'confess';
 use Scalar::Util 'blessed', 'weaken';
 
-our $VERSION   = '0.88';
+our $VERSION   = '0.92';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -20,6 +20,8 @@ sub immutable_options { %{ $_[0]{__immutable}{options} } }
 sub is_mutable   { 0 }
 sub is_immutable { 1 }
 
+sub _immutable_metaclass { ref $_[1] }
+
 sub superclasses {
     my $orig = shift;
     my $self = shift;
@@ -37,6 +39,7 @@ sub remove_method         { _immutable_cannot_call() }
 sub add_attribute         { _immutable_cannot_call() }
 sub remove_attribute      { _immutable_cannot_call() }
 sub remove_package_symbol { _immutable_cannot_call() }
+sub add_package_symbol    { _immutable_cannot_call() }
 
 sub class_precedence_list {
     my $orig = shift;
@@ -81,15 +84,6 @@ sub get_method_map {
     $self->{__immutable}{get_method_map} ||= $self->$orig;
 }
 
-sub add_package_symbol {
-    my $orig = shift;
-    my $self = shift;
-    confess "Cannot add package symbols to an immutable metaclass"
-        unless ( caller(3) )[3] eq 'Class::MOP::Package::get_package_symbol';
-
-    $self->$orig(@_);
-}
-
 1;
 
 __END__