Beefy Boxes and Bandwidth Generously Provided by pair Networks
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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-23 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found