X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FWrapped.pm;h=11492d594effe570e6635a96228c4924ff4bee58;hb=342c0218f20cac0d4201e3d02eadc79d98bd3ac1;hp=4e72a5919c48d8452b876931b0ebfc754c310e4a;hpb=7fe2c0b65ce511286856916fc8f245d2d3bc4f9c;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method/Wrapped.pm b/lib/Class/MOP/Method/Wrapped.pm index 4e72a59..11492d5 100644 --- a/lib/Class/MOP/Method/Wrapped.pm +++ b/lib/Class/MOP/Method/Wrapped.pm @@ -26,9 +26,10 @@ my $_build_wrapped_method = sub { $modifier_table->{after}, $modifier_table->{around}, ); + my $c; if (@$before && @$after) { $modifier_table->{cache} = sub { - $_->(@_) for @{$before}; + for $c (@$before) { $c->(@_) }; my @rval; ((defined wantarray) ? ((wantarray) ? @@ -37,14 +38,14 @@ my $_build_wrapped_method = sub { ($rval[0] = $around->{cache}->(@_))) : $around->{cache}->(@_)); - $_->(@_) for @{$after}; + for $c (@$after) { $c->(@_) }; return unless defined wantarray; return wantarray ? @rval : $rval[0]; } } elsif (@$before && !@$after) { $modifier_table->{cache} = sub { - $_->(@_) for @{$before}; + for $c (@$before) { $c->(@_) }; return $around->{cache}->(@_); } } @@ -58,7 +59,7 @@ my $_build_wrapped_method = sub { ($rval[0] = $around->{cache}->(@_))) : $around->{cache}->(@_)); - $_->(@_) for @{$after}; + for $c (@$after) { $c->(@_) }; return unless defined wantarray; return wantarray ? @rval : $rval[0]; }