... At this point i'm not sure if i'm repeating myself or not ...

q{ You have an odd notion of what's "clean" }. This is true, I learnt perl by reading merlyn's (et al) llama and TheDamian's Perl Best Practices, so I suspect that my view may be a little tainted by what I've been told is "just the right way to do it".

Yes, you do get stuff from the SYNOPSIS the first time, but after that, you should be able to guess the interface of the module, getters, setters and all should become fairlly obvious to guess after a short period of use.

q{ Well, different things should look different, right? }. Yes this is true, a constructor should look like one, and a setter method should look like one. Things should look different, but if something is wrong, it should always look wrong.

$f00li5h = f00li5h->new(); $f00li5h->{moose}; # looks wrong because my objects never work +that way $f00li5h->get_moose; # *magic* $f00li5h->set_moose( 8 ); # *magic* $doom = Doom->new(); $doom->get_moose; # looks wrong - your objects don't work like + that $doom->{moose} # wrong-o $doom->moose; # *joy* this is the ticket $doom->set_moose( 21 ); # looks right to people who often use doom's + objects
I suppose that i've just somewhat countered my own point, but get_* and set_* will always look right on instances of my class, and always look wrong on instances of yours (as long as the instances are named uniformly - ie you don't call an instance of Doom something like $f00li5h)

I'd say that their looking similar makes for a uniform interface... also:

$f00li5h->get_foo; $f00li5h->set_foo('new value');
don't look too similar due to the argument to set_*

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

In reply to Re^7: Method Chaining and Accessors by f00li5h
in thread Method Chaining and Accessors by linenoise

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.