That means more code I or a maintenance programmer has to wade through to understand what's going on
That's exactly why I like to spell out the accessors in my code. No other module to understand to know what the code is doing.
Additionally, your method assumes a particular implementation (in this case, a blessed hashref)
Uhm, no. Look again.
Not only does it make it easy for another programmer to violate encapsulation (even if it's only by accident), it also means that it's more work to switch your object to a blessed array ref or inside out objects.
Actually, the accessors are for inside-out objects, and if you want to switch to blessed array refs, you can leave the accessors I wrote them just they way they are. They will keep working.
use Class::BuildMethods qw/foo bar baz/;

With that, I get three accessors/mutators without code duplication or reliance on the internals.

And a dependency on another module, who's internals are more complicated than one-liner accessors.

I'd love to see the code of Class::BuildMethods that works independently of how the class using it is implemented, without denying the using class direct access to its data.

Perl --((8:>*

In reply to Re^5: Can I please have *simple* modules? by Perl Mouse
in thread Can I please have *simple* modules? by Ovid

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.