in reply to Right place to put common execute code in App::Cmd
This is the kind of place where aspect-oriented programming is awesome. If you're using Moose, Moo or another OO library that supports method modifiers, then it's probably just a matter of creating a role with a before execute method modifier and then applying it to all your command classes.
Otherwise, if you have a base class for all your command classes, you could try creating a method called before_execute and then manually modifying all your execute methods to call $_[0]->before_execute at the start.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Right place to put common execute code in App::Cmd
by McA (Priest) on Dec 10, 2012 at 15:06 UTC | |
by tobyink (Canon) on Dec 10, 2012 at 16:43 UTC |