in reply to Re: Object Oriented Perl - very basic guide
in thread Object Oriented Perl - very basic guide
I'm afraid I wouldn't call that a feature - more like a bug. The whole reason to use OO in the first place is to allow encapsulation - such that you publish methods and handle what those methods actually do internally.
That's what allows me to write a module, you to use it, and then me to bug fix, tweak, extend without breaking your code.
It's something that does no harm at first, but promotes bad programming practice and burns you later - something perl is notorious for.
I've seen a suggestion that basically involves trying to enforce this, via building your object around an anonymous hashref. Because messing with attributes directly breaks first time someone does it, they don't do it a second time.
I feel largely the same about pulling in vague stuff via @_ or building an object off a hashref. It's not that it doesn't work (and in many ways, this is the biggest fault of perl - that things that _shouldn't_ work, usually do). But that you can build in some really horrific bugs and gotchas by doing it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Object Oriented Perl - very basic guide
by bcarroll (Pilgrim) on Jul 06, 2014 at 20:15 UTC |