When an attribute property is malformed (such as lazy without a default), give the...
[gitmo/Moose.git] / lib / Moose / Meta / Role / Composite.pm
index 6e15b31..281e9dc 100644 (file)
@@ -4,10 +4,8 @@ use strict;
 use warnings;
 use metaclass;
 
-use Carp            'confess';
-use Scalar::Util    'blessed', 'reftype';
-
-use Data::Dumper;
+use Carp         'confess';
+use Scalar::Util 'blessed', 'reftype';
 
 our $VERSION   = '0.01';
 our $AUTHORITY = 'cpan:STEVAN';
@@ -54,11 +52,12 @@ sub alias_method {
     (defined $method_name && $method_name)
         || confess "You must define a method name";
 
-    my $body = (blessed($method) ? $method->body : $method);
-    ('CODE' eq (reftype($body) || ''))
-        || confess "Your code block must be a CODE reference";
+    # make sure to bless the 
+    # method if nessecary 
+    $method = $self->method_metaclass->wrap($method) 
+        if !blessed($method);
 
-    $self->get_method_map->{$method_name} = $body;
+    $self->get_method_map->{$method_name} = $method;
 }
 
 1;
@@ -101,7 +100,7 @@ Stevan Little E<lt>stevan@iinteractive.comE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2006, 2007 by Infinity Interactive, Inc.
+Copyright 2006-2008 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>