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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |