Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
All,
I have read perldoc perlsub and perldoc attributes and I just don't get it. In my opinion, the examples leave a lot to be desired such as how and why one my want to use attributes. I am aware of the warning in the documentation indicating attribute declaration for variables is still evolving, so I will stick to subroutines for the purpose of this question. As far as I can tell, an attribute is nothing more than a label you can give to a subroutine that you can later query. I don't see much usefulness in this. I would have thought that it would somehow effect the way a subroutine behaved when it was invoked like the built-in attributes :lvalue and :locked. There is a current conversation in the CB on this topic right now, but it seemed to me like a perfect opportunity to make a post so everyone could benefit from it. It is nice that you can label subs to make certain specific tasks easier but I was hoping there was a more general use that was more powerful. Cheers - L~R In reply to How Are Attributes Useful? by Limbic~Region
|
|