in reply to Subroutine attributes for solving crosscutting problems
That's a neat way to do it. I've been kicking around the idea of using attributes in some of my programming but just haven't found a situation where they're the best solution yet.
It's not demonstrated in your example here but something that would be a nice additional feature would be to allow compile time enabling/disabling of the effects of the attribute. In this case, logging.
Ideally this could be used as a way to turn logging on and off based on some condition or configuration so the transition from development to production would require no code changes logging wise.
Lastly, I don't think you need to shift $self then hand it back to the code ref call. Just do $code->( @_ ) with the whole stack.
|
|---|