Mod aren t you hungry9/7/2023 ![]() ![]() My ($orig, $self, = $self->name, ' runs to the front of the 'Wheek!' Modifying a role’s method with around might look like this: #!/usr/bin/env perl (And as Graham Knop and Karen Etheridge later remarked on IRC, override isn’t even an option if you’re using Moo as an alternative to Moose.) His point was that when you decide to compose roles (also know as traits) instead of or in addition to more traditional inheritance, override simply doesn’t work: only a method modifier will do. He noted that “at a minimum override only works if you’re subclassing, around will apply to composed methods too.” Chris Prather on the #moose IRC channel suggested soon after that the around method modifier (or its little sisters before and after) might be a better choice if you’re also calling the original method inside. Last month I wrote about using Moose’s override function to, well, override a superclass’s method.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |