Version 1.04
[gitmo/Moose.git] / lib / Moose / Meta / Role / Composite.pm
index ee86b7f..4fe720d 100644 (file)
@@ -6,7 +6,7 @@ use metaclass;
 
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.93';
+our $VERSION   = '1.04';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -48,9 +48,7 @@ sub new {
     }
 
     my @composition_roles = map {
-        $_->has_composition_class_roles
-            ? @{ $_->composition_class_roles }
-            : ()
+        $_->composition_class_roles
     } @{ $params{roles} };
 
     if (@composition_roles) {
@@ -127,10 +125,19 @@ sub apply_params {
 }
 
 sub reinitialize {
-    my ($class, $old_meta, @args) = @_;
-    Moose->throw_error('Moose::Meta::Role::Composite instances can only be reinitialized from an existing metaclass instance')
-        if !blessed $old_meta || !$old_meta->isa('Moose::Meta::Role::Composite');
-    return $old_meta->meta->clone_object($old_meta, @args);
+    my ( $class, $old_meta, @args ) = @_;
+
+    Moose->throw_error(
+        'Moose::Meta::Role::Composite instances can only be reinitialized from an existing metaclass instance'
+        )
+        if !blessed $old_meta
+            || !$old_meta->isa('Moose::Meta::Role::Composite');
+
+    my %existing_classes = map { $_ => $old_meta->$_() } qw(
+        application_role_summation_class
+    );
+
+    return $old_meta->meta->clone_object( $old_meta, %existing_classes, @args );
 }
 
 1;
@@ -192,9 +199,7 @@ string with the package name, as there is no real package for composite roles.
 
 =head1 BUGS
 
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
+See L<Moose/BUGS> for details on reporting bugs.
 
 =head1 AUTHOR
 
@@ -202,7 +207,7 @@ Stevan Little E<lt>stevan@iinteractive.comE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2006-2009 by Infinity Interactive, Inc.
+Copyright 2006-2010 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>