On Mon May 26 12:30:44 2014, david.warring wrote: > Hi There, > The following example is presented in > http://perl6advent.wordpress.com/2010/12/22/day-22-the-meta-object- > protocol/ > > sub log-calls($obj, Role $r) { > my $wrapper = RoleHOW.new; > for $r.^methods -> $m { > $wrapper.^add_method($m.name, method (|$c) { > # print logging information > # note() writes to standard error > note ">> $m"; > # call the next method of the same name, > # with the same arguments > nextsame; > }); > } > $wrapper.^compose(); > # the 'does' operator works just like 'but', but > # only modifies a copy of the object > $obj does $wrapper; > } > > This is pre-NOM and clearly dated. Role and RoleHOW just don't exist > for starters. > > There just isn't a good example, or documentation anywhere that I can > find, showing how to do this in 2014. > > I'd suggest maybe revisiting this topic in the 2014 advent posts.
Added this request for docs to the WANTED list under perl6/doc on github. Closing ticket. -- Will "Coke" Coleda