From: Stevan Little Date: Tue, 28 Feb 2006 19:29:27 +0000 (+0000) Subject: preserving call context X-Git-Tag: 0_20~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=45e9e2c34d673ebfa732054b7da6df7f2910a5ef;p=gitmo%2FClass-MOP.git preserving call context --- diff --git a/lib/Class/MOP/Method.pm b/lib/Class/MOP/Method.pm index 912368a..4de0cdf 100644 --- a/lib/Class/MOP/Method.pm +++ b/lib/Class/MOP/Method.pm @@ -45,21 +45,16 @@ sub new { }; my $method = $code->new(sub { $_->(@_) for @{$modifier_table->{before}}; - my (@rlist, $rval); + my @rval; if (defined wantarray) { - if (wantarray) { - @rlist = $modifier_table->{around}->{cache}->(@_); - } - else { - $rval = $modifier_table->{around}->{cache}->(@_); - } + @rval = $modifier_table->{around}->{cache}->(@_); } else { $modifier_table->{around}->{cache}->(@_); } $_->(@_) for @{$modifier_table->{after}}; return unless defined wantarray; - return wantarray ? @rlist : $rval; + return wantarray ? @rval : $rval[0]; }); $MODIFIERS{$method} = $modifier_table; $method;