I have a Moose class that is intended to be subclassed, and every subclass has to implement an "execute" method. However, I would like to put apply a method modifier to the execute method in my class, so that it applies to the execute method in all subclasses. But method modifiers are not preserved when a method is overriden. Is there any way to ensure that all subclasses of my class will have my method modifier applied to their execute methods?
Example: In a superclass, I have this:
before execute => sub {
print "Before modifier is executing.\n"
}
Then, in a subclass of that:
sub execute {
print "Execute method is running.\n"
}
When the execute method is called, it doesn't say anything about the "before" modifier.