Use with_meta in Moose, Moose::Role, and docs (rather than with_caller)
[gitmo/Moose.git] / lib / Moose / Util.pm
index cf99f2e..243793c 100644 (file)
@@ -187,7 +187,10 @@ sub _build_alias_package_name {
 
 sub add_method_modifier {
     my ( $class_or_obj, $modifier_name, $args ) = @_;
-    my $meta                = find_meta($class_or_obj);
+    my $meta
+        = $class_or_obj->can('add_before_method_modifier')
+        ? $class_or_obj
+        : find_meta($class_or_obj);
     my $code                = pop @{$args};
     my $add_modifier_method = 'add_' . $modifier_name . '_method_modifier';
     if ( my $method_modifier_type = ref( @{$args}[0] ) ) {