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';
(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;
=head1 COPYRIGHT AND LICENSE
-Copyright 2006, 2007 by Infinity Interactive, Inc.
+Copyright 2006-2008 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>