From: Dave Rolsky Date: Sun, 19 Feb 2012 19:58:31 +0000 (-0600) Subject: Weaken the $metaclass closed over by the meta method. X-Git-Tag: 2.0500~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMoose.git;a=commitdiff_plain;h=c21e08da2330901dee2d52eb96eaa48670c578bf Weaken the $metaclass closed over by the meta method. This breaks some cycles (notably in anon metaclasses, where it actually matters). --- diff --git a/lib/Class/MOP/Method/Meta.pm b/lib/Class/MOP/Method/Meta.pm index 980afe7..bc50405 100644 --- a/lib/Class/MOP/Method/Meta.pm +++ b/lib/Class/MOP/Method/Meta.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Carp 'confess'; -use Scalar::Util 'blessed'; +use Scalar::Util 'blessed', 'weaken'; use constant DEBUG_NO_META => $ENV{DEBUG_NO_META} ? 1 : 0; @@ -20,6 +20,8 @@ sub _is_caller_mop_internal { sub _generate_meta_method { my $method_self = shift; my $metaclass = shift; + weaken($metaclass); + sub { # this will be compiled out if the env var wasn't set if (DEBUG_NO_META) {