Let's say I have to use a property over and over.

I should have made this a little more clear: If we're just talking about one property copied into one scalar that gets used many times, or maybe even two or three properties/scalars, then doing so is probably still acceptable. But as soon as you do this more than that, then I'd start considering it "too much".

Maybe I should concentrate on making more regular use of my editor's autocomplete feature and just live with the uglier code.

I coded in Java for many years, where AbstractClassNameImplementationFactory.withReallyLongAndDescripiveMethodNames() are common - this seems horrible to some, but once you get good at using the editor's autocomplete, you hardly notice this stuff anymore. The same can apply in Perl, if you look at it the right way, i.e. reconsider your notion of "ugly" - $self->method_name (and the fact this doesn't interpolate) is just part of Perl's OO style, if you accept Perl's OO then consider accepting that part too :-)

Also, there are other things you can do, for example in Perl it's very common to use $obj->prop and $obj->prop("newval") instead of $obj->get_prop() and $obj->set_prop("newval"), respectively. And it's also possible to shorten $self to $s or similar, so instead of $self->get_foo(), now you've got $s->foo, already a lot shorter.


In reply to Re^3: Method for reducing tedium of transferring object properties to scalars by haukex
in thread Method for reducing tedium of transferring object properties to scalars by nysus

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.