From: Jesse Luehrs Date: Tue, 26 Apr 2011 03:04:13 +0000 (-0500) Subject: stop closing over method objects when installing modifiers X-Git-Tag: 2.0100~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=85d8f99649af0149371c9b1b7e769c2971cdee2a;p=gitmo%2FMoose.git stop closing over method objects when installing modifiers --- diff --git a/lib/Class/MOP/Method/Wrapped.pm b/lib/Class/MOP/Method/Wrapped.pm index 6a7345c..84204e1 100644 --- a/lib/Class/MOP/Method/Wrapped.pm +++ b/lib/Class/MOP/Method/Wrapped.pm @@ -72,7 +72,7 @@ sub wrap { my $modifier_table = { cache => undef, - orig => $code, + orig => $code->body, before => [], after => [], around => { @@ -87,6 +87,7 @@ sub wrap { # unless explicitly overriden package_name => $params{package_name} || $code->package_name, name => $params{name} || $code->name, + original_method => $code, modifier_table => $modifier_table, ); @@ -114,7 +115,7 @@ sub _new { sub get_original_method { my $code = shift; - $code->{'modifier_table'}->{orig}; + $code->original_method; } sub add_before_modifier { @@ -162,7 +163,7 @@ sub after_modifiers { unshift @{$code->{'modifier_table'}->{around}->{methods}} => $modifier; $code->{'modifier_table'}->{around}->{cache} = $compile_around_method->( @{$code->{'modifier_table'}->{around}->{methods}}, - $code->{'modifier_table'}->{orig}->body + $code->{'modifier_table'}->{orig} ); $_build_wrapped_method->($code->{'modifier_table'}); }