This is actually fairly well detailed in Class::MOP::Class here =>
http://search.cpan.org/~drolsky/Class-MOP-
0.91/lib/Class/MOP/Class.pm#Method_Modifiers
On Thu Jul 30 10:39:50 2009, BrigJ@IntoText.com wrote:
Show quoted text> Just so that I understand, method modifiers run as separate methods from
> the intended method so that effectively what's happening is an
> invocation of:
>
> $object->method(1, 2);
>
> would be treated as:
> $object->before(1, 2);
> $object->method(1, 2);
>
> so that 'before' receives a ref to the object as its first parameter,
> such that
> my $self = shift;
> works for the 'before' part
>
> and then 'method' receives a ref to the same object so that its
> my $self = shift;
> also knows about the object at hand.
>
>
> Suppose the 'before' sub alters '@_' via 'shift', that won't change what
> 'method' sees when it starts processing '@_', correct, since they each
> receive a set of the original parameters (1, 2) for use via their own
> @_? Or do 'before' and 'method' each work off of the same "@_" array so
> that changes by 'before' affect what 'method' sees in @_?