Ditto for Moose (in Perl)...
before draw => sub { shift->move( 50, 50 )}; sub draw { shift->draw_something } after draw => sub { shift->move( -50, -50 )};
{ package DrawRole; use Moose::Role; before draw => sub { shift->move( 50, 50 )}; after draw => sub { shift->move( -50, -50 )}; } my $d = Draw->new; DrawRole->meta->apply( $d );
Ditto for Moose (in Perl)...
Also you can package up these method modifiers into a role which not only can be composed into a class but can also be applied just to an object...