It's a private init method and the code is right next to the new (probably): just set em - what else is an init for?

Adding a pile of common code to the constructor so it performs half the initialization just seems silly, especially if there are multiple constructors for the object and the init provides the common work.

You're not hiding stuff away (the "action at a distance" concern) because you've said up front that the init routine is going to init stuff - that's what an init routine is for after all. Any maintainer who can't figure out that a routine called init is going to update the object in interesting ways probably is in for a bunch of trouble (or is about to create a bunch of trouble) anyway.


Perl is environmentally friendly - it saves trees

In reply to Re: Passing object attributes around by GrandFather
in thread Passing object attributes around by wfsp

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.