Weaken the associated_metaclass after cloning a method.
[gitmo/Moose.git] / lib / Class / MOP / Method.pm
index 078a434..fca4601 100644 (file)
@@ -7,8 +7,6 @@ use warnings;
 use Carp         'confess';
 use Scalar::Util 'weaken', 'reftype', 'blessed';
 
-our $AUTHORITY = 'cpan:STEVAN';
-
 use base 'Class::MOP::Object';
 
 # NOTE:
@@ -129,6 +127,7 @@ sub clone {
     my $self = shift;
 
     my $clone = bless { %{$self}, @_ }, blessed($self);
+    weaken($clone->{associated_metaclass}) if $clone->{associated_metaclass};
 
     $clone->_set_original_method($self);
 
@@ -242,6 +241,12 @@ If this method is a clone of a clone (of a clone, etc.), this method
 returns the fully qualified name from the I<first> method in the chain
 of clones.
 
+=item B<< $metamethod->is_stub >>
+
+Returns true if the method is just a stub:
+
+  sub foo;
+
 =item B<< $metamethod->attach_to_class($metaclass) >>
 
 Given a L<Class::MOP::Class> object, this method sets the associated