For clarity, instance variables are defined within methods and while in many classes they are all defined in the constructor (method) this is not always so.

I guess I should have said: Mostly, instance variables are defined within a constructor, or within a method called (directly or indirectly) by a constructor. But in some (rare?) cases, instance variables are recycled (via constructors and destructors) from an object pool created in a BEGIN block and stored in a class variable (array or hash) at package scope. (Am I still missing something here?)

I'm sure that many are - but "most"? Do you have any data to back this up?

No, that was merely my impression from reading PerlMonks! But the point I wanted to get across to the OP was this: If you come to Perl from an OO language like Java or C++, Perl’s core OO features may appear underwhelming. But Moose and related modules are in common use, and provide many of the OO features you were expecting. So by all means learn how OO works in Perl, but don’t judge “Perl OO” by its core mechanisms alone.

I'll get off my soapbox now.

The issues you raise are worth discussing, and your points are well made.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re^3: Object oriented Perl and Java: A brief examination of design. by Athanasius
in thread Object oriented Perl and Java: A brief examination of design. by Anonymous Monk

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.