Moose::Meta::Method::Accessor:
[gitmo/Moose.git] / lib / Moose / Meta / Role.pm
index fbe9424..c35f7cd 100644 (file)
@@ -9,9 +9,11 @@ use Carp         'confess';
 use Scalar::Util 'blessed';
 use B            'svref_2object';
 
-our $VERSION = '0.05';
+our $VERSION   = '0.07';
+our $AUTHORITY = 'cpan:STEVAN';
 
 use Moose::Meta::Class;
+use Moose::Meta::Role::Method;
 
 use base 'Class::MOP::Module';
 
@@ -152,7 +154,7 @@ sub _clean_up_required_methods {
 # this is an UGLY hack
 sub get_method_map {    
     my $self = shift;
-    $self->{'%:methods'} ||= {}; 
+    $self->{'%!methods'} ||= {}; 
     $self->Moose::Meta::Class::get_method_map() 
 }
 
@@ -326,7 +328,7 @@ sub _check_required_methods {
             my $method = $other->get_method($required_method_name);
             # check if it is an override or a generated accessor ..
             (!$method->isa('Moose::Meta::Method::Overriden') &&
-             !$method->isa('Class::MOP::Attribute::Accessor'))
+             !$method->isa('Class::MOP::Method::Accessor'))
                 || confess "'" . $self->name . "' requires the method '$required_method_name' " . 
                            "to be implemented by '" . $other->name . "', the method is only a method modifier";
             # before/after/around methods are a little trickier
@@ -365,10 +367,20 @@ sub _apply_attributes {
             }
         }
         else {
-            $other->add_attribute(
-                $attribute_name,
-                $self->get_attribute($attribute_name)
-            );
+            # NOTE:
+            # this is kinda ugly ...
+            if ($other->isa('Moose::Meta::Class')) { 
+                $other->_process_attribute(
+                    $attribute_name,
+                    %{$self->get_attribute($attribute_name)}
+                );             
+            }
+            else {
+                $other->add_attribute(
+                    $attribute_name,
+                    $self->get_attribute($attribute_name)
+                );                
+            }
         }
     }    
 }
@@ -540,15 +552,6 @@ sub combine {
     return $combined;
 }
 
-package Moose::Meta::Role::Method;
-
-use strict;
-use warnings;
-
-our $VERSION = '0.01';
-
-use base 'Class::MOP::Method';
-
 1;
 
 __END__
@@ -561,9 +564,9 @@ Moose::Meta::Role - The Moose Role metaclass
 
 =head1 DESCRIPTION
 
-Moose's Roles are being actively developed, please see L<Moose::Role> 
-for more information. For the most part, this has no user-serviceable 
-parts inside. It's API is still subject to some change (although 
+Please see L<Moose::Role> for more information about roles. 
+For the most part, this has no user-serviceable parts inside
+this module. It's API is still subject to some change (although 
 probably not that much really).
 
 =head1 METHODS
@@ -724,7 +727,7 @@ Stevan Little E<lt>stevan@iinteractive.comE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2006 by Infinity Interactive, Inc.
+Copyright 2006, 2007 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>