From: Shawn M Moore Date: Sun, 3 May 2009 18:57:44 +0000 (-0400) Subject: Weaken the references to role and class, like everything else does X-Git-Tag: 0.78~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=154a4aae762133d9f18cd1df5d40743a1878d78e;p=gitmo%2FMoose.git Weaken the references to role and class, like everything else does --- diff --git a/lib/Moose/Meta/Role/Application/ToClass.pm b/lib/Moose/Meta/Role/Application/ToClass.pm index c8c443c..5d05e60 100644 --- a/lib/Moose/Meta/Role/Application/ToClass.pm +++ b/lib/Moose/Meta/Role/Application/ToClass.pm @@ -5,7 +5,7 @@ use warnings; use metaclass; use Moose::Util 'english_list'; -use Scalar::Util 'blessed'; +use Scalar::Util 'weaken', 'blessed'; our $VERSION = '0.77'; $VERSION = eval $VERSION; @@ -15,19 +15,18 @@ use base 'Moose::Meta::Role::Application'; __PACKAGE__->meta->add_attribute('role' => ( reader => 'role', - writer => 'set_role', )); __PACKAGE__->meta->add_attribute('class' => ( reader => 'class', - writer => 'set_class', )); sub apply { my ($self, $role, $class) = @_; - $self->set_role($role); - $self->set_class($class); + # We need weak_ref in CMOP :( + weaken($self->{role} = $role); + weaken($self->{class} = $class); $self->SUPER::apply($role, $class);