On Sat, 8 May 2010 15:27:31 +0200, Eric Veith1 <[email protected]> wrote:
>     foreach(@complement) {
>         $self->meta->add_around_method_modifier('__execute');
>     }
> }
> ---->%----
> 
> As you might have guessed from the snipped, the modifier's subroutine is
> called "__execute".
> 
> First, is there a more elegant way of building the method list?
> 
> Second, this code makes Perl spit out an error message:
> 
> ----%<----
> Can't use an undefined value as a subroutine reference
> at /usr/lib/perl5/x86_64-linux-thread-multi/Class/MOP/Class.pm line 719.
> ---->%----

Method modifiers are coderefs, not method names, and all the
add_*_method_modifier methods take two arguments, not just one.  

perldoc Class::MOP::Class

also note that all the examples in Moose::Manual::MethodModifiers use coderefs.

hdp.

Reply via email to