Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Subroutine attributes for solving crosscutting problemsby bennymack (Pilgrim) |
on Sep 08, 2006 at 00:58 UTC ( [id://571838]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Meditations
|
|