Merge ../Moose-error into pluggable_errors
[gitmo/Moose.git] / lib / Moose / Meta / Role / Composite.pm
index 281e9dc..92b47a5 100644 (file)
@@ -4,10 +4,10 @@ use strict;
 use warnings;
 use metaclass;
 
-use Carp         'confess';
-use Scalar::Util 'blessed', 'reftype';
+use Scalar::Util 'blessed';
 
-our $VERSION   = '0.01';
+our $VERSION   = '0.57';
+$VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Moose::Meta::Role';
@@ -34,12 +34,12 @@ sub new {
     my ($class, %params) = @_;
     # the roles param is required ...
     ($_->isa('Moose::Meta::Role'))
-        || confess "The list of roles must be instances of Moose::Meta::Role, not $_"
+        || Moose::throw_error("The list of roles must be instances of Moose::Meta::Role, not $_")
             foreach @{$params{roles}};
     # and the name is created from the
     # roles if one has not been provided
     $params{name} ||= (join "|" => map { $_->name } @{$params{roles}});
-    $class->meta->new_object(%params);
+    $class->_new(\%params);
 }
 
 # NOTE:
@@ -50,12 +50,15 @@ sub new {
 sub alias_method {
     my ($self, $method_name, $method) = @_;
     (defined $method_name && $method_name)
-        || confess "You must define a method name";
+        || Moose::throw_error("You must define a method name");
 
     # make sure to bless the 
     # method if nessecary 
-    $method = $self->method_metaclass->wrap($method) 
-        if !blessed($method);
+    $method = $self->method_metaclass->wrap(
+        $method,
+        package_name => $self->name,
+        name         => $method_name
+    ) if !blessed($method);
 
     $self->get_method_map->{$method_name} = $method;
 }
@@ -107,4 +110,4 @@ L<http://www.iinteractive.com>
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
-=cut
\ No newline at end of file
+=cut