First, the new method normally takes parameters that match all my attributes.

As others have mentioned, the constructor can take any parameters you want to provide. Moose provides the mechanism, not the policy.

... why is it the caller's (the user of the object) business what my object's internal state is?

The constructor API is only the constructor API you declare. I have plenty of objects which take data provided to their constructors and then are effectively immutable. It's a nice pattern, when you can arrange your objects to behave in that fashion. As you say:

They will be used by the setup code to construct and arrange the various internal machinery of this instance, and may not be needed again ever.

... which matches my experience in many—but not all—objects.

... the framers of the system decided this was the normal thing to do, and the whole idea makes no sense to me.

I think you're overthinking it. People who create objects with accessors and mutators and constructor parameters for each and every attribute end up with slightly encapsulated structs and the concomitant risks. Moose allows that. Moose also allows people to create objects with neither accessors nor mutators and purely constructor parameters and various combinations of dependent attributes thereof. Where Moose expresses an opinion on how to design your objects, it offers a preference for declarative syntax and encapsulation. How far you take that encapsulation is up to you.

Is there a separate slot-access syntax that's not in the tutorials and manual?

In the sense of private, protected, or friend modifiers, no. Those don't really work in practice, especially in Perl. (I believe you need special hardware memory protection to make them robust. Then good luck writing a performant garbage collector.)


In reply to Re: Psychic Disconnect and Object Systems by chromatic
in thread Psychic Disconnect and Object Systems by John M. Dlugosz

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.