From 92f9ce683247b58ef533d3dd1f83bbd5536dd314 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 21 Sep 2009 01:31:58 -0500 Subject: if we pass in a method object rather than a coderef, use its metaclass --- lib/MooseX/MethodTraits.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/MooseX/MethodTraits.pm b/lib/MooseX/MethodTraits.pm index 14a7280..29214c3 100644 --- a/lib/MooseX/MethodTraits.pm +++ b/lib/MooseX/MethodTraits.pm @@ -1,5 +1,6 @@ package MooseX::MethodTraits; use Moose::Exporter; +use Scalar::Util qw(blessed); =head1 NAME @@ -29,8 +30,9 @@ sub _generate_method_creators { # initializing attributes in the method traits that are applied my ($method, $args) = $munge->(@_); + my $superclass = blessed($method) || $meta->method_metaclass; my $method_metaclass = Moose::Meta::Class->create_anon_class( - superclasses => [$meta->method_metaclass], + superclasses => [$superclass], roles => $traits, cache => 1, ); -- cgit v1.2.3-54-g00ecf