rename AttributeBase -> AttributeCore
Dave Rolsky [Mon, 28 Dec 2009 17:06:53 +0000 (11:06 -0600)]
lib/Class/MOP.pm
lib/Class/MOP/Attribute.pm
lib/Class/MOP/Mixin/AttributeCore.pm [moved from lib/Class/MOP/Mixin/AttributeBase.pm with 98% similarity]
lib/Class/MOP/Mixin/HasAttributes.pm
t/000_load.t
t/014_attribute_introspection.t
xs/AttributeBase.xs
xs/MOP.xs

index 0ae3a0c..01a619e 100644 (file)
@@ -12,7 +12,7 @@ use Carp          'confess';
 use Scalar::Util  'weaken', 'reftype', 'blessed';
 use Try::Tiny;
 
-use Class::MOP::Mixin::AttributeBase;
+use Class::MOP::Mixin::AttributeCore;
 use Class::MOP::Mixin::HasAttributes;
 use Class::MOP::Mixin::HasMethods;
 use Class::MOP::Class;
@@ -380,8 +380,8 @@ Class::MOP::Class->meta->add_attribute(
 # _construct_class_instance method.
 
 ## --------------------------------------------------------
-## Class::MOP::Mixin::AttributeBase
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+## Class::MOP::Mixin::AttributeCore
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('name' => (
         reader   => {
             # NOTE: we need to do this in order
@@ -390,85 +390,85 @@ Class::MOP::Mixin::AttributeBase->meta->add_attribute(
             #
             # we just alias the original method
             # rather than re-produce it here
-            'name' => \&Class::MOP::Mixin::AttributeBase::name
+            'name' => \&Class::MOP::Mixin::AttributeCore::name
         }
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('accessor' => (
-        reader    => { 'accessor'     => \&Class::MOP::Mixin::AttributeBase::accessor     },
-        predicate => { 'has_accessor' => \&Class::MOP::Mixin::AttributeBase::has_accessor },
+        reader    => { 'accessor'     => \&Class::MOP::Mixin::AttributeCore::accessor     },
+        predicate => { 'has_accessor' => \&Class::MOP::Mixin::AttributeCore::has_accessor },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('reader' => (
-        reader    => { 'reader'     => \&Class::MOP::Mixin::AttributeBase::reader     },
-        predicate => { 'has_reader' => \&Class::MOP::Mixin::AttributeBase::has_reader },
+        reader    => { 'reader'     => \&Class::MOP::Mixin::AttributeCore::reader     },
+        predicate => { 'has_reader' => \&Class::MOP::Mixin::AttributeCore::has_reader },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('initializer' => (
-        reader    => { 'initializer'     => \&Class::MOP::Mixin::AttributeBase::initializer     },
-        predicate => { 'has_initializer' => \&Class::MOP::Mixin::AttributeBase::has_initializer },
+        reader    => { 'initializer'     => \&Class::MOP::Mixin::AttributeCore::initializer     },
+        predicate => { 'has_initializer' => \&Class::MOP::Mixin::AttributeCore::has_initializer },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('definition_context' => (
-        reader    => { 'definition_context'     => \&Class::MOP::Mixin::AttributeBase::definition_context     },
+        reader    => { 'definition_context'     => \&Class::MOP::Mixin::AttributeCore::definition_context     },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('writer' => (
-        reader    => { 'writer'     => \&Class::MOP::Mixin::AttributeBase::writer     },
-        predicate => { 'has_writer' => \&Class::MOP::Mixin::AttributeBase::has_writer },
+        reader    => { 'writer'     => \&Class::MOP::Mixin::AttributeCore::writer     },
+        predicate => { 'has_writer' => \&Class::MOP::Mixin::AttributeCore::has_writer },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('predicate' => (
-        reader    => { 'predicate'     => \&Class::MOP::Mixin::AttributeBase::predicate     },
-        predicate => { 'has_predicate' => \&Class::MOP::Mixin::AttributeBase::has_predicate },
+        reader    => { 'predicate'     => \&Class::MOP::Mixin::AttributeCore::predicate     },
+        predicate => { 'has_predicate' => \&Class::MOP::Mixin::AttributeCore::has_predicate },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('clearer' => (
-        reader    => { 'clearer'     => \&Class::MOP::Mixin::AttributeBase::clearer     },
-        predicate => { 'has_clearer' => \&Class::MOP::Mixin::AttributeBase::has_clearer },
+        reader    => { 'clearer'     => \&Class::MOP::Mixin::AttributeCore::clearer     },
+        predicate => { 'has_clearer' => \&Class::MOP::Mixin::AttributeCore::has_clearer },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('builder' => (
-        reader    => { 'builder'     => \&Class::MOP::Mixin::AttributeBase::builder     },
-        predicate => { 'has_builder' => \&Class::MOP::Mixin::AttributeBase::has_builder },
+        reader    => { 'builder'     => \&Class::MOP::Mixin::AttributeCore::builder     },
+        predicate => { 'has_builder' => \&Class::MOP::Mixin::AttributeCore::has_builder },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('init_arg' => (
-        reader    => { 'init_arg'     => \&Class::MOP::Mixin::AttributeBase::init_arg     },
-        predicate => { 'has_init_arg' => \&Class::MOP::Mixin::AttributeBase::has_init_arg },
+        reader    => { 'init_arg'     => \&Class::MOP::Mixin::AttributeCore::init_arg     },
+        predicate => { 'has_init_arg' => \&Class::MOP::Mixin::AttributeCore::has_init_arg },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('default' => (
         # default has a custom 'reader' method ...
-        predicate => { 'has_default' => \&Class::MOP::Mixin::AttributeBase::has_default },
+        predicate => { 'has_default' => \&Class::MOP::Mixin::AttributeCore::has_default },
     ))
 );
 
-Class::MOP::Mixin::AttributeBase->meta->add_attribute(
+Class::MOP::Mixin::AttributeCore->meta->add_attribute(
     Class::MOP::Attribute->new('insertion_order' => (
-        reader      => { 'insertion_order' => \&Class::MOP::Mixin::AttributeBase::insertion_order },
-        writer      => { '_set_insertion_order' => \&Class::MOP::Mixin::AttributeBase::_set_insertion_order },
-        predicate   => { 'has_insertion_order' => \&Class::MOP::Mixin::AttributeBase::has_insertion_order },
+        reader      => { 'insertion_order' => \&Class::MOP::Mixin::AttributeCore::insertion_order },
+        writer      => { '_set_insertion_order' => \&Class::MOP::Mixin::AttributeCore::_set_insertion_order },
+        predicate   => { 'has_insertion_order' => \&Class::MOP::Mixin::AttributeCore::has_insertion_order },
     ))
 );
 
@@ -699,7 +699,7 @@ $_->meta->make_immutable(
     constructor_name    => undef,
     inline_accessors => 0,
 ) for qw/
-    Class::MOP::Mixin::AttributeBase
+    Class::MOP::Mixin::AttributeCore
     Class::MOP::Mixin::HasAttributes
     Class::MOP::Mixin::HasMethods
 /;
index 7bd6839..ead19fc 100644 (file)
@@ -14,7 +14,7 @@ our $VERSION   = '0.97';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
-use base 'Class::MOP::Object', 'Class::MOP::Mixin::AttributeBase';
+use base 'Class::MOP::Object', 'Class::MOP::Mixin::AttributeCore';
 
 # NOTE: (meta-circularity)
 # This method will be replaced in the
similarity index 98%
rename from lib/Class/MOP/Mixin/AttributeBase.pm
rename to lib/Class/MOP/Mixin/AttributeCore.pm
index 62d84a4..f1b9089 100644 (file)
@@ -1,4 +1,4 @@
-package Class::MOP::Mixin::AttributeBase;
+package Class::MOP::Mixin::AttributeCore;
 
 use strict;
 use warnings;
index 7103fa8..2cac5e2 100644 (file)
@@ -17,9 +17,9 @@ sub add_attribute {
     my $attribute
         = blessed( $_[0] ) ? $_[0] : $self->attribute_metaclass->new(@_);
 
-    ( $attribute->isa('Class::MOP::Mixin::AttributeBase') )
+    ( $attribute->isa('Class::MOP::Mixin::AttributeCore') )
         || confess
-        "Your attribute must be an instance of Class::MOP::Mixin::AttributeBase (or a subclass)";
+        "Your attribute must be an instance of Class::MOP::Mixin::AttributeCore (or a subclass)";
 
     $self->_attach_attribute($attribute);
 
index 6060948..4e0fe9d 100644 (file)
@@ -5,7 +5,7 @@ use Test::More;
 
 BEGIN {
     use_ok('Class::MOP');
-    use_ok('Class::MOP::Mixin::AttributeBase');
+    use_ok('Class::MOP::Mixin::AttributeCore');
     use_ok('Class::MOP::Mixin::HasAttributes');
     use_ok('Class::MOP::Mixin::HasMethods');
     use_ok('Class::MOP::Package');
@@ -32,7 +32,7 @@ my %METAS = (
     'Class::MOP::Method::Accessor'  => Class::MOP::Method::Accessor->meta,
     'Class::MOP::Method::Constructor' =>
         Class::MOP::Method::Constructor->meta,
-    'Class::MOP::Mixin::AttributeBase'   => Class::MOP::Mixin::AttributeBase->meta,
+    'Class::MOP::Mixin::AttributeCore'   => Class::MOP::Mixin::AttributeCore->meta,
     'Class::MOP::Mixin::HasAttributes'   => Class::MOP::Mixin::HasAttributes->meta,
     'Class::MOP::Mixin::HasMethods'      => Class::MOP::Mixin::HasMethods->meta,
     'Class::MOP::Package'         => Class::MOP::Package->meta,
@@ -83,7 +83,7 @@ is_deeply(
         Class::MOP::Method::Generated->meta,
         Class::MOP::Method::Inlined->meta,
         Class::MOP::Method::Wrapped->meta,
-        Class::MOP::Mixin::AttributeBase->meta,
+        Class::MOP::Mixin::AttributeCore->meta,
         Class::MOP::Mixin::HasAttributes->meta,
         Class::MOP::Mixin::HasMethods->meta,
         Class::MOP::Module->meta,
@@ -101,7 +101,7 @@ is_deeply(
             Class::MOP::Class
             Class::MOP::Class::Immutable::Class::MOP::Class
             Class::MOP::Class::Immutable::Trait
-            Class::MOP::Mixin::AttributeBase
+            Class::MOP::Mixin::AttributeCore
             Class::MOP::Mixin::HasAttributes
             Class::MOP::Mixin::HasMethods
             Class::MOP::Instance
index e38b616..25d52c6 100644 (file)
@@ -67,7 +67,7 @@ use Class::MOP;
 
     is_deeply(
         [
-            sort Class::MOP::Mixin::AttributeBase->meta->get_method_list,
+            sort Class::MOP::Mixin::AttributeCore->meta->get_method_list,
             $meta->get_method_list
         ],
         [ sort @methods ],
@@ -98,7 +98,7 @@ use Class::MOP;
 
     is_deeply(
         [
-            sort Class::MOP::Mixin::AttributeBase->meta->get_attribute_list,
+            sort Class::MOP::Mixin::AttributeCore->meta->get_attribute_list,
             $meta->get_attribute_list
         ],
         [ sort @attributes ],
index b29a14c..4381497 100644 (file)
@@ -1,8 +1,8 @@
 #include "mop.h"
 
-MODULE = Class::MOP::Mixin::AttributeBase   PACKAGE = Class::MOP::Mixin::AttributeBase
+MODULE = Class::MOP::Mixin::AttributeCore   PACKAGE = Class::MOP::Mixin::AttributeCore
 
 PROTOTYPES: DISABLE
 
 BOOT:
-    INSTALL_SIMPLE_READER(Mixin::AttributeBase, name);
+    INSTALL_SIMPLE_READER(Mixin::AttributeCore, name);
index faa7704..9ca0970 100644 (file)
--- a/xs/MOP.xs
+++ b/xs/MOP.xs
@@ -13,7 +13,7 @@ find_method (const char *key, STRLEN keylen, SV *val, void *ud)
 
 EXTERN_C XS(boot_Class__MOP__Mixin__HasMethods);
 EXTERN_C XS(boot_Class__MOP__Package);
-EXTERN_C XS(boot_Class__MOP__Mixin__AttributeBase);
+EXTERN_C XS(boot_Class__MOP__Mixin__AttributeCore);
 EXTERN_C XS(boot_Class__MOP__Method);
 
 MODULE = Class::MOP   PACKAGE = Class::MOP
@@ -25,7 +25,7 @@ BOOT:
 
     MOP_CALL_BOOT (boot_Class__MOP__Mixin__HasMethods);
     MOP_CALL_BOOT (boot_Class__MOP__Package);
-    MOP_CALL_BOOT (boot_Class__MOP__Mixin__AttributeBase);
+    MOP_CALL_BOOT (boot_Class__MOP__Mixin__AttributeCore);
     MOP_CALL_BOOT (boot_Class__MOP__Method);
 
 # use prototype here to be compatible with get_code_info from Sub::Identify