At some point, an inherited class has to know a little more about the internals of its parent than other code. This goes for any language, not just Perl. Not necessarily all the details, just more than normal.
Further, I never consider data in the object's underlieing reference to be private. Rather, it's more analagous to Java's protected variables, which are explicitly allowed to be fiddled with by classes in the same namespace and/or subclasses. Java enforces this, though obviously Perl doesn't (without doing a lot of extra work, anyway).
If the parent wants a truely private variable, it should have done:
package Foo; my ($host, $port); # Private vars # rest of class
Lexically scoped variables are very hard to get at outside the given lexical scope. At least as hard as a private var in Java.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
In reply to Re^2: Is Perl Truly an Object Oriented Language?
by hardburn
in thread Is Perl Truly an Object Oriented Language?
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |