On 01/09/2011 02:26 AM, Sean McAfee wrote: > On Sat, Jan 8, 2011 at 3:50 PM, Moritz Lenz <mor...@faui2k3.org> wrote: > >> class MyMatcher { >> for <FOO BAR BAZ BLETCH QUUX> -> $field { >> MyMatcher.^add_method($field, method() { >> self!matches($field); >> } >> ); >> } >> } >> >> The .^ means a method of the metaclass is called, here add_method >> >> Maybe you'll find >> http://perlgeek.de/en/article/discovering-meta-object-protocolinteresting. >> >> > I did, but now I'm wondering how one would do this in the case of an > anonymous class.
my $class = ClassHOW.new_class(); # just leave out the name here for @list -> $field { $class.^add_method(....); }