The main reason I don't like this is because it makes inheritance awkward. If you are inheriting from another class that's using such an 'attrib' function as well, you have to know which attributes it's dealing with (it may for instance do validation), and you'll have to filter those and pass it to SUPER. With a long inheritance tree, this becomes awkward.
Another reason I don't like it is that, as presented, anyone can set and inspect any attribute. That includes typoed attributes, or just someone being "nasty".
And I fail to see the benefit for the user of this class. To me, the only advantage I can see is that the author of the module saves adding a few accessors - at the expensive of an inflexible, complicated, do-it-all routine.
Good modules are optimized for the user, not the author. (Even if the same person performs both roles).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.